* FUNCTION: DL_Date.prg * AUTHOR: George Tasker * DATE: February 17, 1999 - 4:09 PM * PURPOSE: Returns the starting or ending date of DS for * the current year LPARAMETERS pstart DECLARE INTEGER GetTimeZoneInformation IN Win32API; STRING @lpTimeZoneInformation LOCAL lnargs, lctimezone, lnresult, ldtresult,; lnyear lnargs = PCOUNT() lnyear = YEAR(DATE()) lctimezone = REPLICATE(CHR(0), 172) lnresult = GetTimeZoneInformation(@lctimezone) ldtresult = {} IF lnresult # 0 IF lnargs = 0 * Get Stopping Date of DLS lnstdmonth = StringToInteger(SUBSTR(lctimezone, 71, 2)) * Windows DOWs are 0 based, VFP's 1 based lnstddow = StringToInteger(SUBSTR(lctimezone, 73, 2)) + 1 lnstdday = StringToInteger(SUBSTR(lctimezone, 75, 2)) ELSE * Get Ending Date of DLS lnstdmonth = StringToInteger(SUBSTR(lctimezone, 155, 2)) lnstddow = StringToInteger(SUBSTR(lctimezone, 157, 2)) + 1 lnstdday = StringToInteger(SUBSTR(lctimezone, 159, 2)) ENDIF ldtresult = ChangeDate(lnstdmonth, lnyear, lnstdday, lnstddow) ENDIF RETURN ldtresult FUNCTION StringToInteger LPARAMETER pcstring, plsigned LOCAL lnresult, lnlast, lni, llsigned,; lnmsb, lnmax lnresult = 0 lnlast = LEN(pcstring) * Return Signed Integer? IF PCOUNT() = 2 llsigned = plsigned ELSE llsigned = .F. ENDIF FOR lni = 1 TO lnlast lnresult = lnresult + ASC(SUBSTR(pcstring, lni, 1)) * (256 ^ (lni - 1)) NEXT IF llsigned lnmsb = (lnlast * 8) - 1 IF BITTEST(lnresult, lnmsb) lnmax = (2 ^ (lnmsb + 1)) lnresult = lnresult - lnmax ENDIF ENDIF RETURN lnresult ENDFUNC FUNCTION ChangeDate LPARAMETERS pnmonth, pnyear, pnweekno, pndow LOCAL ldresult IF pnweekno = 5 ldresult = FirstDay(pnmonth + 1, pnyear, pndow) - 7 ELSE ldresult = FirstDay(pnmonth, pnyear, pndow) + ((pnweekno - 1) * 7) ENDIF RETURN ldresult ENDFUNC FUNCTION FirstDay LPARAMETERS pnmonth, pnyear, pndow * Parameter list description * pnmonth the month number (1-12) * pnyear the year number * pndow the day of the week (Sunday = 1, Monday = 2, etc.) LOCAL ldresult, lddate, lndow, lcdateset lddate = CTOD("^" + STR(pnyear) + "/" + STR(pnmonth) + "/1") ldresult = lddate lnfirstday = DOW(lddate, 1) IF lnfirstday # pndow IF lnfirstday < pndow ldresult = lddate + (pndow - lnfirstday) ELSE ldresult = lddate + (7 + pndow) - lnfirstday ENDIF ENDIF RETURN ldresult ENDFUNCPass it any parameter to get the starting date. No parameter returns the ending date of Daylight Savings. With a little modification it can be made to return the start/stop dates for any year.