Android Question DateTime.DateParse() Parse Problem

Richard Goh

Active Member
Licensed User
Longtime User
Hi, I got a problem on Datetime.DateParse function. IT's always return me with unparsable date exception no matter how I change the date to "04/10/2013" or "10/04/2013". Is that a bugs?

Dim exp As Long
exp = DateTime.DateParse("10/04/2013")
 

FHEBERT

Member
Licensed User
Longtime User
Hello,
I have also a problem with DateParse.
I get a date from a text file. format : dd/MM/yyyy.
When I try to parse this date, I have an error "unparseable date: "06/03/2015" (at offset 0).

The code is very simple :

Dim Reader As TextReader
Dim line As String
DateTime.DateFormat = "dd/MM/yyyy"

Reader.Initialize(File.OpenInput(File.DirRootExternal, "/file_date.txt"))

line = Reader.ReadLine
Reader.close
Dim date As String : date=line.Trim
Dim parse_date As Long
parse_date=DateTime.DateParse(date)

Thanks for your help
 
Upvote 0

FHEBERT

Member
Licensed User
Longtime User
Hello,
I found my mistake.
My mistake was in the date comparison, not in the parsing .
I compared two dates with the string format instead of the number of ticks !
 
Upvote 0
Top