TimeParse issue

qsrtech

Active Member
Licensed User
Longtime User
Hi, I get this error when parsing a time including seconds:

java.text.ParseException: Unparseable date: "8:00:00 PM" (at offset 4)

I don't seem to get an error when there are no seconds included in the time string. Is this by design or am I doing something wrong?
 

qsrtech

Active Member
Licensed User
Longtime User
Thanks, after posting I thought about this and updated my timeformat to include seconds. It now works, but this does seem like a strange behavior since one would assume (wrongly in this case) that the timeparse function would just strip the seconds off automatically and not raise an error.

Btw, Is there a way to include seconds in a time inputdialog?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
It now works, but this does seem like a strange behavior since one would assume (wrongly in this case) that the timeparse function would just strip the seconds off automatically and not raise an error.
Each approach has its advantages and disadvantages. Because of this error you know that the format was wrong and you can fix it. It would have been much more difficult to find this mistake otherwise.

Btw, Is there a way to include seconds in a time inputdialog?
I'm afraid not.
 
Upvote 0
Top