Article ID: 190265
Article Last Modified on 1/23/2007
* Note that bdate and edate are assigned the first day of April and the
* last day of October in this example. You would want to change these
* variables to be equal to the DATE() function in a real situation.
CLEAR
IF "6.00"$VERSION(1)
oldstrictdate = SET("STRICTDATE")
SET STRICTDATE TO 0
ENDIF
bdate = {04/01/98} && Change year to check other dates,
edate = {10/31/98} && use the DATE() function for real time.
y = ""
IF MONTH(bdate) = 4 AND DAY(bdate) < 8 && First week of April.
* Need first day of month and current year, change to DATE().
bsavings = CTOD('04/01/' + ALLTRIM(STR(YEAR(BDATE))))
=getnum(CDOW(bsavings)) && Get number to add to first day of April.
? "Daylight Saving Time starts on Sunday - "
?? bsavings + VAL(SUBSTR(y,1,1))
? "The first day of April is: "
?? CDOW(bsavings)
ENDIF
IF MONTH(edate) = 10 AND DAY(edate) > 24 && Last week of October.
* Need last day of month and current year, change to DATE().
esavings = CTOD('10/31/' + ALLTRIM(STR(YEAR(EDATE))))
=getnum(CDOW(esavings)) && Get number to subtract from 10/31.
? "Daylight Saving Time ends on Sunday - "
?? esavings - VAL(SUBSTR(y,2,1))
? "The last day of October is: "
?? CDOW(esavings)
ENDIF
IF "6.00"$VERSION(1)
SET STRICTDATE TO &oldstrictdate
ENDIF
PROCEDURE getnum
PARAMETER dayvar
DO CASE
CASE dayvar = "Sunday"
y='00'
CASE dayvar = "Monday"
y='61'
CASE dayvar = "Tuesday"
y='52'
CASE dayvar = "Wednesday"
y='43'
CASE dayvar = "Thursday"
y='34'
CASE dayvar = "Friday"
y='25'
CASE dayvar = "Saturday"
y='16'
ENDCASE
********************* End of code *******************
Additional query words: kbvfp600
Keywords: kbhowto kbcode KB190265