Page 1 of 1

Converting String to Timestamp 24 hour format

Posted: Tue May 20, 2014 8:28 am
by harishvardhan
I need to convert "2014/03/21 5:48:26 PM" to timestamp 24 hour format.
the result should be 2014-03-21 17:48:26 can anyone tell me how to do this.

Posted: Tue May 20, 2014 9:02 am
by dsetlteam
First use convert/ereplace for "/" to "-" conversion,then use StringToTimestamp (In case you are reading from a varchar column) with following setting - %yyyy-%mm-%dd %H:%n:%s %aa

Posted: Tue May 20, 2014 9:36 am
by chulett
Are we talking about two strings? They would have to be for this to make sense but wanted to explicitly check.

Posted: Tue May 20, 2014 10:29 am
by chulett
If so, then it is two conversions - first a StringToTimestamp using the existing external format (no need to change any delimiters) followed by a TimestampToString using the new desired external format.