'=========================================================================== ' Subject: LEAP YEAR ALGORITHM UPDATE Date: 03-09-99 (19:05) ' Author: Nigel Traves Code: QB, QBasic, PDS ' Origin: tarot@ihalliwell.freeserve.co.u Packet: DATETIME.ABC '=========================================================================== 'Some time ago I submitted a set of routines that were inspired by 'similar ones that are part of ansi C. Unfortunately the algorithm 'that I found for determining if a year was in fact a leap year was 'wrong and meant that overall the package would not be Y2K compliant '(the dreaded millennium bug strikes again!). Having now got the 'correct algorithm for determining leap years I have produced this 'update. Serendipitously (oooo, big woid - just means happy accident), 'leap year determination was limited to a single SUB, so all that needs 'doing is to replace the existing SUB with the one below. ' ' N. Traves 3/1999 SUB ThisInstant ( Now AS When ) GetDate Now.Year, Now.Month, Now.MonthDay, Now.WeekDay Now.IsLeapYear = FALSE% IF (Now.Year MOD 400) = 0 THEN Now.IsLeapYear = TRUE% ELSEIF ((Now.Year MOD 4) = 0) AND ((Now.Year MOD 100) <> 0) THEN Now.IsLeapYear = TRUE% END IF DayOfYear Now.Month, Now.MonthDay, Now.IsLeapYear, Now.YearDay WeekOfYear Now.YearDay, Now.YearWeek GetTime Now.Hour, Now.Minute, Now.Second END SUB