View previous topic :: View next topic |
Author |
Message |
psridhar Beginner
Joined: 16 May 2004 Posts: 68 Topics: 26
|
Posted: Mon Feb 06, 2006 6:36 am Post subject: Conversion of date format using REXX... |
|
|
Hi
I have my date as year and no of days in that year as below.
Year : 2005
No of days in that year : 306
Is there a way to convert this in to DD.MM.YYYY format...
For the above example, output should be 02.11.2005
Thanks in advance
Sridhar P |
|
Back to top |
|
 |
ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Mon Feb 06, 2006 8:14 am Post subject: |
|
|
Here is an example:
Code: | /* rexx */
MYYEAR = 2006
MYDAY = 36
SAY DATE('E',SUBSTR(MYYEAR,3,2)RIGHT(MYDAY,3,'0'),'J')
EXIT |
O.
________
Ford Essex V6 engine history
Last edited by ofer71 on Sat Feb 05, 2011 11:30 am; edited 1 time in total |
|
Back to top |
|
 |
psridhar Beginner
Joined: 16 May 2004 Posts: 68 Topics: 26
|
Posted: Mon Feb 06, 2006 12:56 pm Post subject: |
|
|
Hi Friend,
Thanks for the info. It solved my purpose.
Regards
Sridhar P |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Mon Feb 06, 2006 2:10 pm Post subject: |
|
|
As a review, the DATE function used in this manner is specified as:
DATE(date_format1 , input_date , date_format2)
where
date_format1 is the format of the date you wish to convert to.
input_date is the date value.
date_format2 is the format of the input_date. |
|
Back to top |
|
 |
robr Beginner
Joined: 28 Apr 2006 Posts: 2 Topics: 0
|
Posted: Wed Jun 27, 2007 12:44 pm Post subject: |
|
|
To reactivate this old thread, why do I get "Incorrect call to routine" for this:
say date("J","31/12/99","E")
I hope to see 99365. |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Jun 27, 2007 1:12 pm Post subject: |
|
|
robr,
The error is because when Julian is used for date_format1, this option is valid only when input_date is not specified.
Try this
Code: |
SAY SUBSTR('31/12/99',7,2)|| DATE('D','31/12/99','E')
|
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
robr Beginner
Joined: 28 Apr 2006 Posts: 2 Topics: 0
|
Posted: Wed Jun 27, 2007 2:49 pm Post subject: |
|
|
Thx, I assume that means that the only solution is to create a separate routine to calculate the Julian date myself
One wonders why the date function has such a strange restriction... |
|
Back to top |
|
 |
|
|