Android Question minutes between two timestamps

tufanv

Expert
Licensed User
Longtime User
Hello

I have found some topics about periodbetween code but i couldnt find calculating hours between to timestamp. For example i will give 2 dates& hour as string as str1 str2
str1 = 2014-11-17 10.00
str2 = 2014-11-20 18.50

I have to get the 3 days and 8.50 hours as minutes

TY
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
Dim p As Period = DateUtils.PeriodBetween(DateTime.DateParse("12/19/1968"),DateTime.Now)
    Log(p.Years&" Years, "&p.Months&" months, "&p.Days&" days")
Look at p.Hours, p.Minutes too
Please note to change the DateParse to your needs too as this example just calculates the AGE of someone (in this case me)
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
You cannot calculate using date formated values... You can only calculate the difference in ticks... Chearch the forum for "ticks", plenty of examples.

Note.:Manfred "gave" you the fish, while I was showing you how to use a fishing rod...
 
  • Like
Reactions: eps
Upvote 0
Top