[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Leap Year



How about something like:

let $Feb28-string = '02/28/' || to_char(#year)
let $Feb28 = strtodate ($Feb28-string, 'MM/DD/YYYY')
let $Mar1-string = '03/01/' || to_char(#year)
let $Mar1 = strtodate ($Mar1-string, 'MM/DD/YYYY')

if datediff ($Mar1, $Feb28, 'day') = 2
                <#year is a leap year>
        else
                <#year is not a leap year>
        end-if


where $Feb28 and $Mar1 are dates and $Feb28-string and $Mar1-string are text
variables.

This will tell you whether your OS thinks the year is a leap year, rather
than thinking about whether a year is the 100th, 400th year, etc.  (if
you're worried about what happens every 100 or 400 years to begin with)

- Mark

-----Original Message-----
From:   Tajinder Chahal [mailto:Tchaha@ROUSHIND.COM]
Sent:   Wednesday, April 18, 2001 11:53 AM
To:     SQR-USERS@list.iex.net
Subject:        Leap Year

Does anyone know if there is a function in SQR which can determine if the
year is a leap year or not?

Thanks in Advance
Tajinder