AustinK
6 years agoQrew Commander
Re: Calculate Daylight Savings time
This is a really tough one to crack but I feel like I am getting closer. I tried earlier but was not able to figure out the calculation for the first Sunday of November. Second Sunday of March is easy enough. Look at this post and go over the rules for daylight savings time it gives and that should help.
https://stackoverflow.com/questions/5590429/calculating-daylight-saving-time-from-only-date/5590518-
You can try this formula. It isn't fully done but I feel like it is almost there. Let me know if you can improve it and it works for you. There may be parts that are not needed in here, just what I put together earlier before stopping. Feels strange giving out something that may or may not work and need to be fixed, but here it is.
The biggest issue with this is possibly the first November Sunday. Although it does actually work at least for 2019 and tested it for this year in March.
var number myMonth = Month([Created or Now]);
var number myDay = Day([Created or Now]);
var number previousSunday = $myDay - DayOfWeek([Created or Now]);
If($myMonth < 3 or $myMonth > 11, "No",
$myMonth >= 3 and $myMonth <= 11,
If(
$myMonth = 3 and $previousSunday >= 8, "Yes",
$myMonth = 11 and $myDay > 7, "No",
$myMonth = 11 and $previousSunday <= 0, "Yes", "No"
), "No"
)
My "Created or Now" field is this:
If(
IsNull([Date Created]), ToDate(Now()), ToDate([Date Created])
)
https://stackoverflow.com/questions/5590429/calculating-daylight-saving-time-from-only-date/5590518-
You can try this formula. It isn't fully done but I feel like it is almost there. Let me know if you can improve it and it works for you. There may be parts that are not needed in here, just what I put together earlier before stopping. Feels strange giving out something that may or may not work and need to be fixed, but here it is.
The biggest issue with this is possibly the first November Sunday. Although it does actually work at least for 2019 and tested it for this year in March.
var number myMonth = Month([Created or Now]);
var number myDay = Day([Created or Now]);
var number previousSunday = $myDay - DayOfWeek([Created or Now]);
If($myMonth < 3 or $myMonth > 11, "No",
$myMonth >= 3 and $myMonth <= 11,
If(
$myMonth = 3 and $previousSunday >= 8, "Yes",
$myMonth = 11 and $myDay > 7, "No",
$myMonth = 11 and $previousSunday <= 0, "Yes", "No"
), "No"
)
My "Created or Now" field is this:
If(
IsNull([Date Created]), ToDate(Now()), ToDate([Date Created])
)