Determining if it’s Daylight Savings time in Fingerprint

Although the current revision of PC and PM printer firmware supports time zones, any time arithmetic in Fingerprint is done in Greenwich Mean time, so you have to adjust your numbers according to your time zone and if it’s Standard or Daylight Savings time.

For example, if it’s five o’clock local time in the Eastern Time zone and you want to calculate an expiration time two hours later, your result will be two hours earlier than the current time during Daylight Savings, and three hours during Standard time. This isn’t a big deal, you only have to add the time offset, but determining if it’s DST or not isn’t obvious.

There’s a function in the Fingerprint language, WEEKDAY that returns a number for the day of the week where Sunday is 1, Monday is 2, etc. So you can get the number of the first day in November,¬† subtract it (plus¬† one) from 7 to calculate the first Sunday in November, when DST ends:

zDST$ = “F”
zCURRENTDATE$ = DATE$

REM WHEN DOES DST END?

A% = WEEKDAY(LEFT$(zCURRENTDATE$,2) + “1101”)
zSTOPDAY$ = RIGHT$((“0” + STR$(7-A%+1)),2)
zSTOPDST$ = LEFT$(zCURRENTDATE$,2) + “11” + zSTOPDAY$

Likewise you can calculate when DST begins (the second Sunday in March)with the same function:

REM WHEN DOES DST BEGIN?

A% = WEEKDAY(LEFT$(zCURRENTDATE$,2) + “0301”)
zSTARTDAY$ = RIGHT$((“0” + STR$(14-A%+1)),2)
zSTARTDST$ = LEFT$(zCURRENTDATE$,2) + “03” + zSTARTDAY$

IF zCURRENTDATE$ <= zSTOPDST$ AND zCURRENTDATE$ >= zSTARTDST$ THEN zDST$=“T”

Of course, Daylight Saving begins and ends at 2 in the morning, but the above should be sufficient for most applications.