After the Daylight Savings Time Errors

After the Daylight Savings Time Errors

  

Hello,


I use different CurrDate () functions. After the Daylight Savings Time, I noticed that suddenly there was a difference of 1 hour to 2 hours difference. My question is now, how can it be that suddenly there is now 2 hours difference instead of the previous 1 hour difference? My application now therefore sometimes returns 1900-01-01. This happend after the last update.

I use this Date:

SyntaxEditor Code Snippet

AddHours(NewDate(Year(CurrDate()),Month(CurrDate()),Day(CurrDate())+9),5)

Result:

1900-01-01 04:00:00

Hi Erwin,

An observation, that has nothing to do with your question, but about programming in general: don't use more than one CurrDate() in an action, ever. The reason is that when the Action runs around midnight, the date may flip over just after the first CurrDate() was calculated but before the second, and all kinds of mayhem ensues. Always have a local variable, e.g. called TargetDate, assign CurrDate() to TargetDate, and from there use TargetDate.

That said, let's look at your problem. I'm really not sure what you mean by "1 hour difference" vs. "2 hour difference" - a difference between what and what? Anyway, your code is flawed: you add 9 to Day(CurrDate()) and try to create a date from that with NewDate(). But that doesn't work of course when the current day + 9 is greater than the allowed number of days in a month. What you need to do is AddDays(CurrDate(), 9) to add 9 days to the current date.

Hi Kilian,

This function worked for more than 2 months and now it don't.

And for the 1 hour difference vs 2 hour difference. First when i posted CurrDateTime() i had 1 hour differentce and if i do it now, i have 2 hours difference.

The function that I have written must always give the same day as order day. Example: If you order on Tuesday and the fixed delivery is Friday. Then there will be 3 days added to it, but if you order on Wednesday, only 2 days will be added. That is what I wanted to do with the job.

Hi Erwin,

This function hasn't worked, because there's a bug in it. I pointed that bug out to you. If you don't understand there's a bug, I can't help you any further.

As for the time difference, I assume you are running in a cloud environment. CurrDate() and CurrDateTime() will always return local time. I assume then that the server is running in a time zone that is equal to UTC and doesn't have DST (though I can't think of an actual time zone close to the Netherlands that doesn't observe DST).