Hi,
can any one tell us how to covert a timestamp field which contains microseconds in it.
My input is coming as :25-MAY-10 01.19.11.968986 PM
we want Output in the format of 2010-05-25 13:19:11.968986
How to handle micro seconds conversion.
Conversion of Timestamp field
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
1. Convert to String.
2. Decompose into components (date, time). Use Field() function.
3. Convert date format. Oconv(Iconv()) with appropriate format strings.
4. Append space and time component (including fractional seconds).
2. Decompose into components (date, time). Use Field() function.
3. Convert date format. Oconv(Iconv()) with appropriate format strings.
4. Append space and time component (including fractional seconds).
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: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
svDatePart:: Oconv(Iconv(Field(InLink.TheTS, " ", 1, 1), "DMY"), "D-YMD[4,2,2]")
Code: Select all
svTimePart:: Oconv(Iconv(Field(Field(InLink.TheTS, " ", 2, 1), ".", 1, 1) : Field(InLink.TheTS, " ", 3, 1), "MT", "MTS")
Code: Select all
svFractionalSeconds:: Field(Field(InLink.TheTS, " ", 2, 1), ".", 2, 1)
Code: Select all
Result:: svDatePart : " " : svTimePart : "." : svFractionalSeconds
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.