tufanv Expert Licensed User Longtime User Oct 21, 2014 #1 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
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 Oct 21, 2014 #2 Code: Copy 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
Code: Copy 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)
Cableguy Expert Licensed User Longtime User Oct 21, 2014 #3 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... Upvote 0
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...