[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Leap Year
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This is not entirely correct.
First you check it with a mod 4, if it is 0 then it might be a leap
year. Then check with a mod 100, if this is not 0 then it is a leap
year. If the mod 100 is a 0 them check it with a mod 400, if this is
zero then it is a leap year. Century years that are not divisible by
400 are not leap years (e.g. 2000 was a leap year, but 2100 is not a
leap year). Avoid the Y2.1K problem :)
some SQR code:
let $Leap_Year = 'N'
if ( ( #Year % 4 ) = 0 )
if ( ( #Year % 100 ) = 0 )
if ( ( #Year % 400 ) = 0 )
move 'Y' to $Leap_Year
end-if
else
move 'Y' to $Leap_Year
end-if
end-if
.....Rob
=====================================================================
Robert Goshko Axis Computer Consulting Services, Inc.
President Sherwood Park, Alberta, Canada
robert.goshko@axis-dev.com http://www.axis-dev.com/
=====================================================================
- -----Original Message-----
From: Discussion of SQR, Brio Technology's database reporting
language
[mailto:SQR-USERS@list.iex.net]On Behalf Of Andy Brook
Sent: April 18, 2001 10:09 AM
To: SQR-USERS@list.iex.net
Subject: Re: Leap Year
Just do a mod (year,4) If the returned value is 0 then the year is
leaping.
I dont know if there is a mod function in SQR but write your own or
use your
rdbms's mod function.
Andy
- -----Original Message-----
From: Tajinder Chahal [mailto:Tchaha@ROUSHIND.COM]
Sent: 18 April 2001 16:53
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
-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.3
Comment: got root?
iQA/AwUBOt3Bejj0Cv9NDz5BEQIz8wCePAYyW2ukIGPF4vG7T/k8Xbw+ZZAAoLkU
KoMnEpydYyz8xg3sFGIO6P1v
=M1L/
-----END PGP SIGNATURE-----