Page 1 of 1

string conversion to timestamp

Posted: Tue Apr 29, 2008 11:02 pm
by ramesh_g
I have source defined as time stamp.But I am getting only date now...later I may get complete time stamp.I am using stringtotimestamp function to convert it using format ,["%yyyy-%mm-%dd %hh:%nn:%ss".Since I am not getting time along with how can I am appending :00:00:00.How can I handle when it comes as complete time stamp in future.( I can not keep append/hard code with 00:00:00).

Posted: Tue Apr 29, 2008 11:36 pm
by BugFree
You can check if the length of the input string.

Code: Select all

If len(trim(In.Field)) = 19 Then StringToTimespamp(In.Field,"%yyyy-%mm-%dd %hh:%nn:%ss") Else StringToTimespamp(In.Field : " 00:00:00","%yyyy-%mm-%dd %hh:%nn:%ss")
The above code will work only if the input is a timestamp or just the date.