View previous topic :: View next topic |
Author |
Message |
ebp Beginner
Joined: 07 Jan 2005 Posts: 2 Topics: 1 Location: New Delhi
|
Posted: Fri Jan 07, 2005 2:05 am Post subject: Built-in Function for Calculating the number of days in REXX |
|
|
Hi! All,
Is there any built-in function to calculate the number of days in a particular year? I want to give the date as input.For example,if I am giving 25/01/2005 as input,that function should return '25' days as result. _________________ Thanks & Rgds,
EBP |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Fri Jan 07, 2005 2:17 am Post subject: |
|
|
ebp,
Please be clear in your question.
Code: |
number of days in a particular year
|
No. of days may be 365 / 366 depending whether the year is a normal year or leap year. Is this what you want ? But your example says:
Code: |
25/01/2005 as input,that function should return '25' days as result.
|
'25' days - do u want to strip off only the date portion from the 'dd/mm/yyyy' input ? In that case you can use SUBSTR(date_text, 1, 2) or LEFT(date_text, 2) to get the date portion alone.
Thanks,
Phantom |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
ebp Beginner
Joined: 07 Jan 2005 Posts: 2 Topics: 1 Location: New Delhi
|
Posted: Sun Jan 09, 2005 3:12 am Post subject: |
|
|
Hi!
Thanks a lot for you all.But, the think is that I need to calculate the number of days from the 1st of Jan to that particular date.For, example, if the input=13/02/2005 then the result should be "44" (31+13) days.I think that my previous post is not clear to you all.Now,I hope that you can understand my question.
In the date function, DATE(d) calculates only for the system date.But, I need to give the date as input.
With Best Regards,
EBP. |
|
Back to top |
|
 |
Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Sun Jan 09, 2005 7:24 am Post subject: |
|
|
ebp,
I think DATE(d, input_date) could be used to get the no. of days since the given input date. I'm not sure. I didn't test this but the manual DOES NOT tell that this is impossible.
Code: |
DATE('D', '15 Jan 2004')
|
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A330/4.3.16?DT=20020521161835
The manual clearly says that the input_date should not be given for 'Century - C' & 'Julian - J' formats but it doesn't say so for 'Days - D' option. So, try and let us know if this works.
Thanks,
Phantom |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
Posted: Mon Jan 10, 2005 9:06 am Post subject: |
|
|
ebp,
You can use Date D for any given date.
try this
Code: |
/* REXX */
MYDATE = 20041012 /*CCYYMMDD */
DAYOFYEAR=DATE('D',MYDATE,'S')
SAY DAYOFYEAR
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|