We are trying to interpret the data stored in Axapata's TIMEZONESRULESDATA table. Particularly, we'd like to figure out how it stores DST begin/end times. So far, my guess is:
TZENUM: foreign key referencing TIMEZONESLIST (time zone name and identifier)
YEAR: 0 if rule is valid indefinitely or a year where the timezone rule is in effect
BIAS: offset to UTC time in minutes
DBIAS: offset of DST (added to BIAS to get total offset from UTC)
Now for the part I don't understand:
DYEAR,DMONTH,DDAYOFWEEK,DDAY,DHOUR,DMINUTE,DSECOND
SYEAR,SMONTH,SDAYOFWEEK,SDAY,SHOUR,SMINUTE,SSECOND
I would guess from the dates that the D* is the start date of DST and S* is end. However, I do not understand why it would need a year and a dayofweek field. Also, *DAY does not seem to indicate the day of month - at least it doesn't indicate the correct one for switching DST. It also doesn't seem to correspond to the dates at which Axapta's own DateTimeUtil or Form autoconversion converts the dates.
Does anyone know how to interprete this table? Or where I could look it up?
Sören
DDAY
andSDAY
represents week of month (1-4, 5 = last week)DDAYOFWEEK
andSDAYOFWEEK
represents day of week (0 = Sunday)How will you use this information?
DDAY and SDAY looked like they indicate the week of month, but then we found DDAY- and SDAY-values of 6, 23 or 28. Are these the weeks of the year, or were the values > 5 hijacked for individual days?
My theory was this: with DMONTH = 8 and DDAYOFWEEK = 6, we have
So what are SDAYs and DDAYs that are larger than 5?
I have made up two SQL functions to convert Dynamics AX UTC dates to the appropriate time zone date/time from TIMEZONESRULESDATA table. They appear to work in the scenarios I've tested but I'd be pleased to get feedback.
The first function is fed the UTC DateTime and TZID from any AX table and generates the Date/Time in the time zone with any daylight savings adjustment:
The second function works out the daylight savings start or end date based on parameters fed from the TIMEZONESRULESDATA fields: