Hello, I'm having a problem with my code, i want to Check the difference (In days) Between two DateTime (Long) Elements.
This is my code:
B4X:
Dim Y, T, TP As Long
Dim S, M, H, D As Int
DateTime.DateFormat = "dd/MM/yyyy"
Y= DateTime.DateParse(Last_Time)
T= DateTime.Now
Y= DateTime.Date(Y) + DateTime.TimeParse("00:00:01")
T= DateTime.Date(T) + DateTime.TimeParse("00:00:01")
TP= T- Y
S= Round(TP/ 1000)
M= Floor(S/ 60) Mod 60
H= Floor(S/ 3600)
D= Floor(H/ 24)
Last_time is a string that contains a Date from MSAccess Converted to String (like 23/05/2013) (dd/mm/yyyy)
But it throws a Java.Lang.NumberFormatException
Value of Y = 1369180800000
Value of T = 1399058075661
Dim last_time As String = "23/05/2013"
Dim Y, T As Long
DateTime.DateFormat = "dd/MM/yyyy"
DateTime.TimeFormat = "HH:mm:ss"
Y= DateTime.DateTimeParse(last_time,"00:00:01")
T= DateTime.DateTimeParse(DateTime.Date(DateTime.Now),"00:00:01")
Dim diff As Period
diff = DateUtils.PeriodBetween(Y,T)
Log("Diff="&diff.Years&" years, "&diff.Months&" months, "&diff.Days&" days, "&diff.Hours&" hours, "&diff.Minutes&" minutes, "&diff.Seconds&" seconds")
Starting from B4A v2.70, DateUtils is included as a library in the IDE.
Kevin is a brandnew member so i suppose he is using v3.5 and therefore he dont need to download anything.
AND he is not marked as an licensed member so he cannot download additional libs. I used this example cause Dateutils is part of a fresh installation without need of download any lib.
Starting from B4A v2.70, DateUtils is included as a library in the IDE.
Kevin is a brandnew member so i suppose he is using v3.5 and therefore he dont need to download anything.
AND he is not marked as an licensed member so he cannot download additional libs. I used this example cause Dateutils is part of a fresh installation without need of download any lib.
Excuse me for not introducing myself, my name is Kevin Rodríguez, i'm actually working as Software Dev in Costa Rica at a Small Place mainly dedicated to Hydrometrics.
After testing a Couple of Platforms and Stuff i got familiarized with B4A as quick as a blink, also, the Community is amazing. (Yeah guys, you're amazing ).