Author |
Message
|
arunkumar1989 |
Posted: Sun Dec 09, 2012 10:16 pm Post subject: CAST TIMESTAMP from 2008-10-10 9:36:24 to dd MON yyyy HH:mm: |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
Hai all
CAST TIMESTAMP from 2008-10-10 9:36:24 to dd MON yyyy HH:mm:ss
Format,
and
CAST DATE from 1988-10-12 to dd-MON-yyyy |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Dec 09, 2012 11:32 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
What is your question?
If it is to do with the correct format string to use in the casts then all the information you need is in the Infocentre, _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Mon Dec 10, 2012 12:09 am Post subject: Need Conversion Code |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
Hi i need conversion code for following statement.
CAST TIMESTAMP from 2008-10-10 9:36:24 ====> dd MON yyyy HH:mm:ss
I want to Change this 2008-10-10 9:36:24 format to
10 OCT 2008 9:36:24
Now clear my question ....  |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Dec 10, 2012 12:45 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
As I said, the answer is there for you to find with a simple search on the infocentre.
look for
Timestamp Formats _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Mon Dec 10, 2012 12:54 am Post subject: |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
in info center they giving few formats only but ... wt i`m expecting its not ther.... |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Dec 10, 2012 1:04 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
arunkumar1989 wrote: |
in info center they giving few formats only but ... wt i`m expecting its not ther.... |
Really? I guess you didn't look very hard
What about this -> http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ak05616_.htm _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Mon Dec 10, 2012 1:25 am Post subject: |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
this i have looked and followed the same....
This is my code..
DECLARE pattern CHARACTER 'dd MMM yy, h:mma';
SET OutputLocalEnvironment.dt1=CAST(trans.TRANSACTIONDATE AS TIMESTAMP FORMAT pattern);
here trans.TRANSACTIONDATE value comming from db....
after executing code alone...in OutputEnvironment shows
dt1=2010-01-01 10:10:25.000
I`m Looking very hard....but i did small mistake... pls help me
 |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Dec 10, 2012 1:36 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
A timestamp has a fixed and known format for representation as a set of characters.
When casting TO a timestamp, the pattern is used to *understand* the INPUT data, not to format the output.
When casting FROM a timestamp, the pattern is used to format the output. |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Mon Dec 10, 2012 2:06 am Post subject: |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
"When casting FROM a timestamp, the pattern is used to format the output."
this wt i`m trying now.... but still i sucking.... |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Dec 10, 2012 3:55 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
What format is the DB Param that is your input? i.e. what is the column type?
Using a Trace Node helps a lot here but I'd expect that you have already done that
The Infocentre has details on how DB columns map to ESQL Datatypes.
 _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Mon Dec 10, 2012 4:13 am Post subject: Thanks |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
Finally i Got the output .
Thanks smdavies99.
I have completed that casting... its simpler one me only made a mistake, but i learned lot. can u give me gmail id... for further doubts mean i can ask... it will be very useful for me.
This is the code for CAST
CAST(trans.TRANSACTIONDATE AS CHARACTER FORMAT('dd MMM yy, HH:mm:ss'));
Thanks a lot  |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 10, 2012 4:25 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
can u give me gmail id... for further doubts mean i can ask... it will be very useful for me. |
"Don't tell him, Pike!"
Personally, I prefer not to give out my email address, although smdavies99 may feel differently. This public forum is great because other WMB developers can read the answers. If you ask your questions in private, via email, then others will not get any benefit. |
|
Back to top |
|
 |
arunkumar1989 |
Posted: Mon Dec 10, 2012 4:31 am Post subject: |
|
|
 Voyager
Joined: 21 Nov 2012 Posts: 98 Location: Chennai
|
Sorry ya... some times...i did not get answers... thats y do not mistake me... again very sorry......  |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Dec 10, 2012 5:12 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
kimbert wrote: |
"Don't tell him, Pike!"
Personally, I prefer not to give out my email address, although smdavies99 may feel differently. This public forum is great because other WMB developers can read the answers. If you ask your questions in private, via email, then others will not get any benefit. |
I wouldn't expect him to get the reference but yes I agree with you about giving out email addresses in a public forum. I get enough spam as it is.
I'm glad that the OP got the answer he was looking for. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 10, 2012 3:32 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I wouldn't expect him to get the reference |
Yes - sorry arunkumar1989. That was a quote from a TV/Radio show called Dad's Army, and only a small percentage of the world's population have even heard of it. Which is a pity, because it's very funny. |
|
Back to top |
|
 |
|