Hi,
I have a string value as "Jan 22 2010 2:12:44:201PM", i want to convert this string value to timestamp like 2010-01-22 14:12:44:201, is there any short way to handle this ? mean minimum using of stage variable.
Thanks
string to timestamp with AM/PM
Moderators: chulett, rschirm, roy
string to timestamp with AM/PM
Ramesh Kumar.M
Is the :201 portion of the time supposed to be milliseconds? Assuming so:
Convert to a timestamp by using StringToTimestamp() with a format specifier of "%mmm %d %yyyy %H:%n:%s:%SSS%aa"
When you're ready to output to a text field, or a flat file, use TimestampToString() with a format specifier of "%yyyy-%mm-%dd %hh:%nn:%ss:%SSS"
You may have to play around with the format specifiers a little bit...they are documented in the Parallel Job Developer Guide.
Regards,
Convert to a timestamp by using StringToTimestamp() with a format specifier of "%mmm %d %yyyy %H:%n:%s:%SSS%aa"
When you're ready to output to a text field, or a flat file, use TimestampToString() with a format specifier of "%yyyy-%mm-%dd %hh:%nn:%ss:%SSS"
You may have to play around with the format specifiers a little bit...they are documented in the Parallel Job Developer Guide.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
Re: Thank you so much
Hi
Please find the error below, while i tried to use your approach
--------------------------------------------------------------------------------
XFR_In_Trans_1,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%mmm %d %yyyy %H:%n%s:%(SSS,v)%aa" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid format [%mmm %d %yyyy %H:%n%s:%(SSS,v)%aa] used for string_from_time type conversion.
--------------------------------------------------------------------------------
Please help in this, whether I have change any default Timestamp String format ?
Please find the error below, while i tried to use your approach
--------------------------------------------------------------------------------
XFR_In_Trans_1,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%mmm %d %yyyy %H:%n%s:%(SSS,v)%aa" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid format [%mmm %d %yyyy %H:%n%s:%(SSS,v)%aa] used for string_from_time type conversion.
--------------------------------------------------------------------------------
Please help in this, whether I have change any default Timestamp String format ?
Ramesh Kumar.M
Thank you my Friend
Hi Friend,
Its working fine , i used the below format to achive this
StringToTimestamp(Column1,"%mmm %(d,s) %yyyy %(H,s):%n:%s:%SSS%(aa,w)")
, thank you so much, i never forget this great help
Its working fine , i used the below format to achive this
StringToTimestamp(Column1,"%mmm %(d,s) %yyyy %(H,s):%n:%s:%SSS%(aa,w)")
, thank you so much, i never forget this great help
Ramesh Kumar.M
Re: Thank you my Friend
Could anyone explain description about following format specifiers?
1)%(d,s)
2)%(H,s)
3)%(aa,w)
1)%(d,s)
2)%(H,s)
3)%(aa,w)
vamsi.4a6 wrote:Could anyone explain description about following format specifiers?
Oddly enough, in a section titled "Date and time formats".jwiles wrote:You may have to play around with the format specifiers a little bit...they are documented in the Parallel Job Developer Guide.
![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