Author |
Message
|
krustyelpayaso |
Posted: Tue Mar 07, 2006 12:48 am Post subject: DATE format |
|
|
Apprentice
Joined: 24 Oct 2005 Posts: 26
|
Hi,
i have a Trace Node, and into this node i would like to make a CURRENT_DATE and CURRENT_TIMESTAMP format. The format type would be:
[DD/MM/YYYY HH:MM:SS]
My source code is like this:
[${CAST(EXTRACT (DAY FROM CURRENT_DATE) AS CHAR FORMAT '99') }/
${CAST(EXTRACT (MONTH FROM CURRENT_DATE) AS CHAR FORMAT '99')}/
${EXTRACT (YEAR FROM CURRENT_DATE)}
${CAST(EXTRACT (HOUR FROM CURRENT_TIMESTAMP) AS CHAR FORMAT '99')}:
${CAST(EXTRACT (MINUTE FROM CURRENT_TIMESTAMP) AS CHAR FORMAT '99')}:
${CAST(EXTRACT (SECOND FROM CURRENT_TIMESTAMP)AS CHAR
FORMAT '99')}]
With this code the result give [7/3/2006 9:30:1.090224E+1] and i would like a result as [07/3/2006 09:30:10] for example.
I've tried with '00' but the result i sthe same. How can i solve this?
A lot of thanks  |
|
Back to top |
|
 |
elvis_gn |
Posted: Tue Mar 07, 2006 1:45 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi krustyelpayaso,
What version of MB are you using ?
I tried your code and it gives me the below....i'm on MB6.
Code: |
[997/ 993/ 2006 9915: 995: 9911] |
I then changed the 99 to 00, it then gives me
Code: |
[07/ 03/ 2006 15: 09: 50] |
Regards. |
|
Back to top |
|
 |
shalabh1976 |
Posted: Tue Mar 07, 2006 1:47 am Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
I am basically a V2.1 person, but I saw in the documentation that Second is extracted as a Float value. So a convert to an Integer might help.
You can try using SUBSTRING also. However I am not very sure of V6 syntax so I may be wrong. _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
krustyelpayaso |
Posted: Tue Mar 07, 2006 1:52 am Post subject: |
|
|
Apprentice
Joined: 24 Oct 2005 Posts: 26
|
Hi elvis_gn,
I'm on MB5...... I'm almost sure than '00' should works, but doesn't it.
 |
|
Back to top |
|
 |
krustyelpayaso |
Posted: Tue Mar 07, 2006 1:59 am Post subject: |
|
|
Apprentice
Joined: 24 Oct 2005 Posts: 26
|
Hi shalabh1976,
I think like you about the seconds . I think there's no a funtion at the MB V5 wich make that simply.
Thanks |
|
Back to top |
|
 |
elvis_gn |
Posted: Tue Mar 07, 2006 2:18 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi krustyelpayaso,
A few days back there was some code posted here, where a variable is declared with the format of timestamp that one required and then, the current timestamp is extracted based on it...
You could try and search and try that out, might work.
Regards. |
|
Back to top |
|
 |
krustyelpayaso |
Posted: Tue Mar 07, 2006 2:28 am Post subject: |
|
|
Apprentice
Joined: 24 Oct 2005 Posts: 26
|
|
Back to top |
|
 |
elvis_gn |
Posted: Tue Mar 07, 2006 2:51 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi krustyelpayaso,
I dont think it is possible....if it could be, people would start coding in the Trace node
Whatever you type in the space without the "${}" will be displayed as such
and you can only reference the Input message's parts...i.e Root, Body etc...
You could code what you want in a compute and make it display in the trace.....
Regards. |
|
Back to top |
|
 |
krustyelpayaso |
Posted: Tue Mar 07, 2006 3:07 am Post subject: |
|
|
Apprentice
Joined: 24 Oct 2005 Posts: 26
|
Thanks friends . I will try to create a Compute Node....follow by a Trace Node.
Thanks again. Good luck! |
|
Back to top |
|
 |
|