Hi
How can i read the timestamp in the following format in Parallel job .
Format of timestamp is "2004-01-01 12:12:12.112"
TIA
Akash[/b]
How to read timestamp in "2004-01-01 12:12:12.112"
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 27
- Joined: Fri Aug 13, 2004 3:36 am
- Location: INDIA
Akash,
if you want to convert this string into a DS internal format then split it into 3 distinct values: Date, Time and Milliseconds
Say "X" is your string "2004-01-01 12:12:12.112",
Then DateVal = ICONV(FIELD(X," ",1),"D4YMD")
TimeVal = ICONV(FIELD(FIELD(X," ",2),".",1),"MTS")
MilliVal = FIELD(X,".",2)
The internal time representation is in integer seconds since midnight and the ICONV and OCONV time conversions will strip out the milliseconds, so you have to add them manually (ICONV'ing a timestring with decimal digits will cause the function to round up by one second).
if you want to convert this string into a DS internal format then split it into 3 distinct values: Date, Time and Milliseconds
Say "X" is your string "2004-01-01 12:12:12.112",
Then DateVal = ICONV(FIELD(X," ",1),"D4YMD")
TimeVal = ICONV(FIELD(FIELD(X," ",2),".",1),"MTS")
MilliVal = FIELD(X,".",2)
The internal time representation is in integer seconds since midnight and the ICONV and OCONV time conversions will strip out the milliseconds, so you have to add them manually (ICONV'ing a timestring with decimal digits will cause the function to round up by one second).
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Arnd's advice only works in the BASIC Transformer stage. If you are using the regular parallel Transformer stage, the answer will depend on where you're reading the timestamp from. If it's a text file you can decompose it using substring techniques. If it's from a database you may also need to perform some kind of CAST operation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 10
- Joined: Wed Dec 15, 2004 2:19 am
Or just post a direct link to the thread in question. ![Wink :wink:](./images/smilies/icon_wink.gif)
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers