B4J Question Error Unparseable date:

Mikelgiles

Active Member
Licensed User
Longtime User
I get a error when using DateTime.DateParse()

java.text.ParseException: Unparseable date: "2/19/2017"

"02/19/2017" works fine. The data I am working with uses dates like 1/1/2017. I am trying to compare two dates to see if one is larger than the other
 

Daestrum

Expert
Licensed User
Longtime User
No problem here parsing the following
B4X:
 Log(DateTime.DateParse("2/19/2017"))
 Log(DateTime.DateParse("1/1/2017"))
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Works for me too, have you changed the date format?
 
Upvote 0

udg

Expert
Licensed User
Longtime User
I'm not sure, but in a DateFormat the number of litterals should be ignored when parsing, so you could try
B4X:
DateTime.DateFormat("M/d/yyyy")
DateTime.DateParse("2/19/2017")
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
I should read stuff better! The problem was that the date was in a array pulled from a CSV file and instead of 2/19/2017 it was "2/19/2017" which is truly not a good date format. It works fine after stripping out the " .
 
Upvote 0

Mikelgiles

Active Member
Licensed User
Longtime User
And a "thank you" to people who tried to help you, don't you think so?

Sorry about that. Thanks for the help. I was assuming (assuming is probably my biggest fault) that a thank you to each reply just created extra traffic on the forum that did not contribute to the forum. I was also assuming that the like button was the substitute but sometimes I even forget to click that. I am pretty new to the forum process and I promise to learn from my mistakes. Again, thanks to all of you!
 
Upvote 0
Top