Datetime conversions

12 views
Skip to first unread message

Peter Bell

unread,
Apr 20, 2020, 4:37:35 PM4/20/20
to CodenameOne Discussions
Hi

I was wondering if in Codenameone there are the smane functions as in vb.net  fpr
1.  convert datetime to double and double to datetime
2.  to get the difference in days, minutes between two dates

ciao. 
Peter Bell

Steve Hannah

unread,
Apr 20, 2020, 8:40:11 PM4/20/20
to codenameone...@googlegroups.com
I usually use date1.getTime() to convert the date to milliseconds since epoch.  Then you can just perform arithmetic to figure out the date, minutes,etc.  Minute, hour, second, day, week are easy to calculate from milliseconds.  Months and years is harder due to varying number of days in months/years.  



--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/ea049a27-2cae-41c2-abee-11ae8940912a%40googlegroups.com.


--
Steve Hannah
Software Developer
Codename One
Reply all
Reply to author
Forward
0 new messages