Author |
Message
|
rharikumar |
Posted: Fri Feb 14, 2014 3:46 am Post subject: TimeStamp Casting Error |
|
|
Novice
Joined: 14 Oct 2013 Posts: 16
|
Hi
I am trying to cast current_timestamp to a specific format and i am not able to achieve the desired result .
Declare targetFormat CHARACTER;
SET targetFormat = 'yyyy-MM-ddTHH:mm:ss.SSS';
SET Environment.Variable.Test3=cast(CURRENT_GMTTIMESTAMP as TIMESTAMP FORMAT 'yyyy-MM-ddTHH:mm:ss.SSS');
The output is - 2014-02-14 11:42:57.270008
Expected Output - 2014-02-14T11:42:57.270008
Kindly provide some guidance . Thanks in advance . |
|
Back to top |
|
 |
Simbu |
Posted: Fri Feb 14, 2014 3:54 am Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
|
Back to top |
|
 |
rharikumar |
Posted: Fri Feb 14, 2014 4:10 am Post subject: |
|
|
Novice
Joined: 14 Oct 2013 Posts: 16
|
Hi Simbhu
Thanks ...I am aware of this reference .
Unless i CAST it to a CHARACTER .. I am unable to bring the 'T' between the date and time .
Formatting it to IU also doest work. |
|
Back to top |
|
 |
Simbu |
Posted: Fri Feb 14, 2014 4:34 am Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
Did you read this?
Quote: |
ESQL data type TIMESTAMP or GMTTIMESTAMP
Output form yyyy-MM-dd'T'HH:mm:ss.SSSZZZ |
the output form itself is having 'T'
also you must cast the timestamp to string and not to timestamp itself with pattern |
|
Back to top |
|
 |
Gralgrathor |
Posted: Fri Feb 14, 2014 4:46 am Post subject: |
|
|
Master
Joined: 23 Jul 2009 Posts: 297
|
|
Back to top |
|
 |
mqjeff |
Posted: Fri Feb 14, 2014 4:56 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Timestamps don't have formats.
Formats are used to parse character data into timestamps or serialize timestamps into characters.
If a field of type TIMESTAMP is not being output from the message tree correctly, then it's a problem with the model being used. |
|
Back to top |
|
 |
rharikumar |
Posted: Fri Feb 14, 2014 4:59 am Post subject: |
|
|
Novice
Joined: 14 Oct 2013 Posts: 16
|
Thanks all for the suggestions .
@Gralgrathor - I did try that . Thanks anyway .
The only problem is i have the casting in place but when the milliseconds are 000 ..they somehow get trimmed and is resulting in a validation failure .
Expected - 2014-02-14T11:42:57.270008
What happens when milliseconds are 0 - 2014-02-14T11:42:57.2700
Thats where i am stuck . |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Feb 15, 2014 7:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You are sure you have the right number of capital S at the end of your format clause?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|