Android Question How to add Hours, Minutes and/or Seconds to a date ?

Jiemde

Member
Licensed User
Hi, I've try to use the "add" from the Dateutils library, but it's only for Years, Months and Days !
can someone can help me ?

Br

Jiemde
 

Mahares

Well Known Member
Licensed User
Yes, you can add hrs, minutes ans secs to a date or time. Here is a small example that adds 3 hrs plus to current time:
B4X:
'Example: Add 3 hrs 34 minutes 12 sec to current time
    Dim p As Period
    p.Seconds=12841
    Dim NextTime As Long = DateUtils.AddPeriod(DateTime.Now, p)
    Log(DateTime.time(NextTime))
 
Top