iOS Question Get the tick value of a date string

ciginfo

Well-Known Member
Licensed User
Is this code right? I want to obtain the tick value of a date "Thedate" registered in a database as date (AAAA-MM-JJ). It seems it does not work.
What is the the syntax of "DateTime.DateTimeParse(Mydate,"")" if I want only date and not time. (I have not time in the database)

B4X:
Dim  Mydate, Newdate, As Long
Mydate = M.Get("Thedate")
DateTime.DateFormat="AAAA-MM-JJ"
DateTime.TimeFormat="H:mma"
Newdate = DateTime.DateTimeParse(Mydate,"")
 

klaus

Expert
Licensed User
In your code you define DateDebut as a Long.
Then you use TheDateDebut = DateTime.DateParse(DateDebut).
But DateTime.DateParse(DateDebut) expects a String and not a Long.
Put a breakpoint in line 204 and look at DateDebut.
 

ciginfo

Well-Known Member
Licensed User
In fact, DateDebut is in my database phpmyadmin as a date (yyyy-MM-dd). There is not variable as date in B4i and i don't know if i have to consider DateDebut as a long or as a string. It seems i have to consider as a string.
 
Top