|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Need eSQL statement to format Current Date/Time |
« View previous topic :: View next topic » |
Author |
Message
|
jrsetters |
Posted: Mon Aug 27, 2012 6:22 am Post subject: Need eSQL statement to format Current Date/Time |
|
|
 Acolyte
Joined: 24 Aug 2011 Posts: 72 Location: Cincinnati, OH
|
It seems like this would be pretty simple, but I have to admit I feel a little dumber every time I try to figure it out.
I simply want to take the current date and time and format it to:
Day of Week Month.Year.Day hh:mm:ss
Following the documentation, I thought the proper format would be:
EEE MMM.dd.yyyy HH:mm:ss
But I just get an exception every time. I am sure it is because I am not using the proper syntax when I get the date and time. I am setting it as a CHAR from the Current_Timestamp then pulling a substring from 12 for 26 (ie 2012-08-27 10:04:32.969620).
Does anyone have something similar that works? |
|
Back to top |
|
 |
Vitor |
Posted: Mon Aug 27, 2012 6:40 am Post subject: Re: Need eSQL statement to format Current Date/Time |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jrsetters wrote: |
But I just get an exception every time. |
What exception?
jrsetters wrote: |
I am setting it as a CHAR from the Current_Timestamp then pulling a substring from 12 for 26 (ie 2012-08-27 10:04:32.969620). |
Do you mean you're casting it into a char, and what's the substring for? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jrsetters |
Posted: Mon Aug 27, 2012 6:41 am Post subject: |
|
|
 Acolyte
Joined: 24 Aug 2011 Posts: 72 Location: Cincinnati, OH
|
Never mind, I found it. It was that whole thing about setting a monkey in front of a typewriter for a thousand years.:
SET NOW = CAST(CURRENT_TIMESTAMP AS CHARACTER FORMAT 'EEE MMMM.dd.yyyy HH:mm:ss'); |
|
Back to top |
|
 |
Vitor |
Posted: Mon Aug 27, 2012 6:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jrsetters wrote: |
Never mind, I found it. It was that whole thing about setting a monkey in front of a typewriter for a thousand years.:
SET NOW = CAST(CURRENT_TIMESTAMP AS CHARACTER FORMAT 'EEE MMMM.dd.yyyy HH:mm:ss'); |
I was sort of thinking something like that should work. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|