Android Question Dateutils add period

wimpie3

Well-Known Member
Licensed User
Longtime User
In the past I've had some problems adding days to dates, where adding a number of days to a date sometimes added a timezone to the date of +1 hour or -1 hour. That makes sense because I probably crossed winter or summer time by adding the days but I don't want to take that into account.

How does dateutils.addperiod behave? Is the result always the next day with the time zone beeing ignored?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
DateUtils.AddPeriod is based on DateTime.Add. Adding days with DateTime.Add or DateUtils.AddPeriod will never change the hour of day unless you have really bad luck and the hour of day falls on an invalid time (there are two hours like this every year in time zones with DST).

If you are adding 24 hours to a date then you will get such errors.
 
Upvote 0
Top