View previous topic :: View next topic |
Author |
Message |
ragha Beginner
Joined: 26 Apr 2005 Posts: 6 Topics: 2
|
Posted: Thu May 26, 2005 5:12 pm Post subject: Update Date in REXX |
|
|
Hi ,
My mainframe time is 12 hours behind the actual time. When I get
DATE() from the REXX it gives me the date 12 hours behind the actual time. Is there any command in REXX which will give me the actual time ; something like DATE() + 12 hours |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Thu May 26, 2005 7:54 pm Post subject: |
|
|
Can't you just add 1 to the current date depending on what the current system TIME is? |
|
Back to top |
|
 |
ragha Beginner
Joined: 26 Apr 2005 Posts: 6 Topics: 2
|
Posted: Fri May 27, 2005 10:44 am Post subject: |
|
|
Sorry would not be able to do it as if the System time is greater than 12PM it will reflect the current date , and if I add 1 to the current date then it would show a future date , which is not desired. Any other idea is appreciated ? |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri May 27, 2005 11:28 am Post subject: |
|
|
Quote: |
Sorry would not be able to do it as if the System time is greater than 12PM it will reflect the current date , and if I add 1 to the current date then it would show a future date , which is not desired. Any other idea is appreciated ?
|
ragha,
Hmm unless I am missing something , it is very easy. Time returns the local time in the 24-hour clock format: hh:mm:ss (hours,minutes, and seconds) by default. Here are some examples, assuming that the time is 4:54 p.m.:
Code: |
TIME() -> '16:54:22'
TIME('C') -> '4:54pm'
TIME('H') -> '16'
TIME('L') -> '16:54:22.123456' /* Perhaps */
TIME('M') -> '1014' /* 54 + 60*16 */
TIME('N') -> '16:54:22'
TIME('S') -> '60862' /* 22 + 60*(54+60*16) */
|
So if you take the hour portion and 12 to and negotiate that value to add 1 day or not.
Code: |
If (hour + 12) > 24
then add 1 day to the day portion of current date
time = (hour + 12) - 24 concat minute concat seconds
end-if
|
Make sure to check if it is a leapyear when adding 1 day
Check this link which discusses about checking the leapyear
http://www.mvsforums.com/helpboards/viewtopic.php?t=2977&highlight=leap
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
ragha Beginner
Joined: 26 Apr 2005 Posts: 6 Topics: 2
|
Posted: Fri May 27, 2005 12:35 pm Post subject: |
|
|
Thanks for the response. I better think that we can get the date from the DB2 table link get CURRENT TIMESTAMP + 12 HOURS, but I dont know how to execute DB2 commands through REXX. If anybody has a sample or template , that would be useful. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Fri May 27, 2005 4:41 pm Post subject: |
|
|
Why go to all that trouble for a simple 2 line programming problem?
Code: | if time('H') <= 11 then
say date()
else
say date(,1+date('B'),'B') |
which can be simplified to a single expression.
Code: | say date(,(time('H')>11)+date('B'),'B') |
|
|
Back to top |
|
 |
|
|