Author |
Message
|
j1 |
Posted: Sat Aug 02, 2003 2:11 pm Post subject: Getting current system date and time |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
Hi,
I need to put in the currend system date and time in the format YYYY-MM-DD-hh.mm.ss.nnnn into an XML field. when i try to do a substring of CURRENT_TIME, i get odd output like TIMESTAMP '2003-08-02 .
Could someone please supply the line of code that will get me the date in the above format.
Thanks,
Sailesh |
|
Back to top |
|
 |
EddieA |
Posted: Sat Aug 02, 2003 3:58 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Take the value you've got back ands SUBSTRING parts of it to get the format you want.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
j1 |
Posted: Sun Aug 03, 2003 10:28 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
I already tried that but the &apos refuses to go away... |
|
Back to top |
|
 |
j1 |
Posted: Sun Aug 03, 2003 10:55 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
For Example, when i try to do the following :
SET TimeString = CURRENT_TIMESTAMP;
SET TimeString1 = (SUBSTRING (TimeString FROM 1 FOR 24));
SET OutputRoot.XML.ServicingPlannerToAccountReassignmentNotification.RelationshipTimestamp = TimeString1;
I get the output:
TIMESTAMP '2003-08-03 11,
while i want just the year part.. Do advise |
|
Back to top |
|
 |
kirani |
Posted: Sun Aug 03, 2003 1:32 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Use this ..
Code: |
SET OutputRoot.XML.ServicingPlannerToAccountReassignmentNotification.RelationshipTimestamp = SUBSTRING(CURRENT_TIMESTAMP FROM 11 FOR 26)
|
to get current timestamp into CCYY-MM-DD HH:MM:SS.nnnnnn format. If you want different format then you can manipulate this string using STRING ESQL function to get desired output. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
EddieA |
Posted: Sun Aug 03, 2003 2:14 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
If you want just the year, then use:
SET TimeString1 = (SUBSTRING (TimeString FROM 12 FOR 4));
Simple really.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
j1 |
Posted: Mon Aug 04, 2003 6:08 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
Thanks Guys!!! Problem Resolved |
|
Back to top |
|
 |
skn |
Posted: Mon Aug 04, 2003 7:15 am Post subject: |
|
|
 Centurion
Joined: 21 May 2003 Posts: 112 Location: Dallas
|
sorry to jump in.if i use get_time at the beggining of my ESQL and at the end do they return the same values(at least thats the impression i got from the manual).what time does the function give then? |
|
Back to top |
|
 |
j1 |
Posted: Mon Aug 04, 2003 7:24 am Post subject: |
|
|
 Centurion
Joined: 23 Jun 2003 Posts: 139
|
As far as i know ...It does return the same time. It also says so in the
ESQL reference book... |
|
Back to top |
|
 |
|