Page 1 of 1
String to Timestamp
Posted: Sat Jan 30, 2010 12:16 am
by kumar66
Hi All,
I want to change a string value (2009-12-13 10:10:25 ) to Timestamp(13/12/2009 10:10:25)
I tried StringtoTimestamp(Input,,"%dd/%mm/%yyyy %hh:%nn:%ss").
But this conversion function is not giving desired output for me.
Please Advise.
Thanks,
Kumar66
Posted: Sat Jan 30, 2010 5:16 am
by ray.wurlod
You specified the delimiter incorrectly. It must be precisely specified.
Code: Select all
StringtoTimestamp(Input,,"%dd-%mm-%yyyy %hh:%nn:%ss")
Posted: Sat Jan 30, 2010 6:12 am
by kumar66
Hi Ray,
Thanks for your input. I tried , but it gives the follwoing error:
Data string '2009-12-13 08:57:45' does not match format '%dd-%mm-%yyyy %hh:%nn:%ss': the value for tag %mm has fewer characters than expected.
Please Advise.
Thanks,
Kumar66
Posted: Sat Jan 30, 2010 6:34 am
by ArndW
Read the error message in detail and change your format to:
StringtoTimestamp(Input,,"%yyyy-%mm-%dd %hh:%nn:%ss")
Posted: Sat Jan 30, 2010 7:18 am
by chulett
Timestamps have no external format, the mask in the function must match what is coming in in the string field, not what you think it should look like.
Posted: Tue Feb 02, 2010 2:25 am
by mgendy
i agree with what chulett said , i also was confused about that before , but now take it as a rule , the mask for the function is telling the function how the input is passed to you and further the function understand the input to manipulate it
Posted: Tue Feb 02, 2010 2:56 am
by ray.wurlod
kumar66 wrote:Data string '2009-12-13 08:57:45' does not match format '%dd-%mm-%yyyy %hh:%nn:%ss'
That is precisely correct.
Just look at it!
Then proceed as Arnd advised.