View previous topic :: View next topic |
Author |
Message |
Rmravi Beginner
Joined: 24 Jun 2004 Posts: 12 Topics: 5
|
Posted: Wed Sep 29, 2004 2:18 am Post subject: Finding Leap year |
|
|
How to find the leap year thru rexx is their any function available ?please help me in that
Ravi |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Sep 29, 2004 5:47 am Post subject: |
|
|
rmravi,
try this
Code: |
/* function checking for a leap year of an ISO date */
isLeap: procedure
parse arg ISOdate
/* catch syntax error produced by wrong date value */
signal on syntax
dummy = Date(, substr(ISOdate,1,4)'0229', 'Standard')
return 1 /* is valid date, --> leap year */
syntax:
return 0 /* is invalid date, --> no leap year */
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Rmravi Beginner
Joined: 24 Jun 2004 Posts: 12 Topics: 5
|
Posted: Wed Sep 29, 2004 6:51 am Post subject: |
|
|
Hi
I am new to rexx while running the peogram it saying the fllowing error could you pls guide me in that
LABEL syntax SPECIFIED BUT COMMAND NOT FOUND |
|
Back to top |
|
|
Rmravi Beginner
Joined: 24 Jun 2004 Posts: 12 Topics: 5
|
Posted: Wed Sep 29, 2004 7:11 am Post subject: |
|
|
Sorry it is my mistake only Thanks Kolusu tahnks lot it is working fine |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed Sep 29, 2004 7:17 am Post subject: |
|
|
kolusu, that certainly makes sense as an algorithm. I always did it by making sure that the year was evenly divisible by 400, or by 4 and 100. I'll be adding this one to my REXX algorithm list. |
|
Back to top |
|
|
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Thu Oct 28, 2004 4:03 pm Post subject: |
|
|
Try this:
Code: |
/* REXX _____________________________________________
| If 2 days between 3/1 and 2/28, it is a leap year. |
|__________________________________________________*/
Do I = 1990 to 2010
If 2 = date('B',I'0301','S') - date('B',I'0228','S') then,
say I 'is leap year'
Else say I 'is not a leap year'
End
|
|
|
Back to top |
|
|
|
|