02-15-2016 09:42 AM
The last time I looked...
The Mug-bearer's solution worked on every day where you did not have a DST event. If the time you start with is in the "witching hour" of 2:00 AM...
Adding a day worth of second wil return the same day OR you will miss a day completely.
So....
Watch out if you are coding for DST timezones.
Ben
02-15-2016 09:42 AM
Those are not actually expression nodes, they are "Convert Unit" nodes. If you have a value without units, it will apply the unit to the number. If you have a value with units, it will convert to the units you tell it to and return a unitless number. So we start with 1 (no units), then have 1 (day) after the first node. After the second node we convert to seconds and strip the units giving 86,400 (no units).
Another way to see it is to right click the constant >> Visible Items >> Unit Label. You can tack on a "d" here for days, and remove the first Unit Convert node.
02-15-2016 09:47 AM
Yes Ben. That was a valid point on DST.
Right now this code runs only in India where DST is not in force. Of course if its deployed in a DST zone then I need to be careful.
Thanks
02-15-2016 09:50 AM
@Gregory wrote:Those are not actually expression nodes, they are "Convert Unit" nodes. If you have a value without units, it will apply the unit to the number. If you have a value with units, it will convert to the units you tell it to and return a unitless number. So we start with 1 (no units), then have 1 (day) after the first node. After the second node we convert to seconds and strip the units giving 86,400 (no units).
Another way to see it is to right click the constant >> Visible Items >> Unit Label. You can tack on a "d" here for days, and remove the first Unit Convert node.
Got it. Thanks for the calrification!
02-15-2016 09:51 AM - edited 02-15-2016 09:55 AM
@ Ben :
Waow... there are still people remembering this 😮
Maybe i'm not that old then
To work around the DST nonesene you could force the time to noon after getting the timestamp, no?
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus