View previous topic :: View next topic |
Author |
Message |
amit4u79 Beginner
Joined: 24 Oct 2005 Posts: 109 Topics: 36 Location: India
|
Posted: Thu Mar 23, 2006 2:32 am Post subject: How to find the previous date using REXX !! |
|
|
Hi,
How do we find the previous date. For e.g. today is 03/23/06 in DATE('U') format, but I have to do some processing for a file named as one of the LLQs in yesterday's date like xxx.yyy.060322
Pls let me know in how simplest of the ways this can be done. It should take care of leap year and year switch( i mean when switch to 2007 from 2006)
Kolusu I checked your forum for various functions related to date but I did not find related info, so posing the query.
Kindly respond.
Regards,
- Amit. _________________ I did not fail; I have found 10,000 ways that would not work - Albert Einstein. |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Thu Mar 23, 2006 5:48 am Post subject: |
|
|
Convert the Date(U) date to a base date Date(B).
Substract 1 from the base date.
Convert the base date back into Date(U) (or whatever other format you choose):
Code: |
/* REXX */
today = '03/23/06'
basedate = Date('B',today,'U')
basedate = basedate - 1
yesterday = Date('U',basedate,'B')
|
|
|
Back to top |
|
 |
amit4u79 Beginner
Joined: 24 Oct 2005 Posts: 109 Topics: 36 Location: India
|
Posted: Thu Mar 23, 2006 9:23 pm Post subject: |
|
|
Hey Superk, thanks a lot for this. Actually I had converted the current date Date('D') and then subtracted 1 and then converted it to Date('O'), but then realised it would not work for say 01/01/2007 as -1 will give me 0.
But yes Base date is the right approach. I will change my code. thanks for this.
Regards,
- Amit. _________________ I did not fail; I have found 10,000 ways that would not work - Albert Einstein. |
|
Back to top |
|
 |
|
|