View previous topic :: View next topic
|
Author |
Message |
padmaraghav
New User
Joined: 17 Dec 2003 Posts: 2
|
|
|
|
H y'all
can anybody tell me how to get the system date and time and how to display it??
Thanks |
|
Back to top |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
Hi padmaraghav,
Can you elaborate your query a little bit ?...which language,platform are you using?
If you use COBOL, you can use -
ACCEPT DATE INTO WS-DATE.
ACCEPT TIME INTO WS-TIME.
DISPLAY WS-DATE WS-TIME.
Regards,
Sandip. |
|
Back to top |
|
|
Sharan
New User
Joined: 22 Dec 2003 Posts: 6 Location: Banaglore
|
|
|
|
Just want to add a little bit on ACCEPT DATE
When you use ACCEPT WS-DATE FROM DATE
29th, Dec , 2003 would be represented as 031229
If you want the date from the system in the format YYYYMMDD you can use ACCEPT WS-DATE FROM DATE YYYYMMDD
29th, Dec , 2003 would be represented as 20031229
If you want the date from the system in the format YYYYDDD you can use ACCEPT WS-DATE FROM DAY YYYYDDD
In this case it would give you the current year and the total number of days starting from Jan 1 of that year
29th, Dec , 2003 would be represented as 2003363
You can also use ACCEPT DAY-OF-WEEK which would give the current day of the week i.e.
1 would mean Monday, 2 would mean tuesday and so on.
If you want to get date from DB2, you could query SYSIBM.SYSDUMMY1 to get the current date or time
SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1 ---- 2003-12-29
SELECT CURRENT_DATE FROM SYSIBM.SYSDUMMY1 ---- 2003-12-29
SELECT CURRENT TIME FROM SYSIBM.SYSDUMMY1 ---- 06.43.08
SELECT CURRENT_TIME FROM SYSIBM.SYSDUMMY1 ----- 06.43.08
Please not that we can also get timestamp from SYSIBM.SYSDUMMY1
Hope this helps
Thanks,
Sharan |
|
Back to top |
|
|
dipakgoyal Warnings : 1 New User
Joined: 02 Aug 2007 Posts: 18 Location: Kolkata
|
|
|
|
Thanks Sharan.
The information is very valuable.
On an additional note,
Its worth mentioning the restriction on the pic clause of the host-variable:
i.e:
for "ACCEPT WS-DATE FROM DATE "
WS-DATE should have PIC clause as 9(6).
Simliarly for " ACCEPT WS-DATE FROM DATE YYYYMMDD ",
it should be 9(8) |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If you're on a COBOL version which does NOT support FUNCTION's (IE: COBOL2), then take a look at the LE (Language Environment) Callable Service routine "CEELOCT", which returns a CCYYMMDD date and an HHMMSSTHM time.
Regards,
Bill |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
Not sure how good it to quote the start date of this thread..
Quote: |
Posted: Thu Dec 18, 2003 12:50 am |
I was in college that time.. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Anuj D. wrote: |
Not sure how good it to quote the start date of this thread..
Quote: |
Posted: Thu Dec 18, 2003 12:50 am |
|
Geez, usually I catch those...boy, did I get sucked into that..... |
|
Back to top |
|
|
|