Page 1 of 1

conversion of date(4) to timestamp(26)

Posted: Wed Oct 31, 2007 5:12 pm
by karrisuresh
HI I have a column of Date(4) and needed to convert in the transformer to timestamp(26)
Could any one give the syntax for this

Thanks in advance
thanks for your time

Suresh

Posted: Wed Oct 31, 2007 5:26 pm
by chulett
Not without some idea what your "DATE(4)" data looks like and what you want to do for the missing date/time portions.

Posted: Wed Oct 31, 2007 6:07 pm
by karrisuresh
I am sorry the date(10) and the corresponding timestamp(26)
If at all anything missing then should be replaced with 00:00
thanks

Posted: Wed Oct 31, 2007 6:39 pm
by ArndW
Use DateToString() to convert your Date into a String, then StringToTimeStamp() to convert that string into a timestamp.

Posted: Wed Oct 31, 2007 6:56 pm
by karrisuresh
I used this one:
StringToTimestamp(DateToString(lnk_xfrm_column.UPDATE_DT),'yyyy-mm-dd hh:nn:ss')
but still not working

Thanks

Posted: Wed Oct 31, 2007 7:09 pm
by ArndW
Try doing things just one step at a time. What is the string output of

Code: Select all

DateToString(lnk_xfrm_column.UPDATE_DT)
for your data?

Posted: Wed Oct 31, 2007 8:06 pm
by karrisuresh
StringToTimestamp(DateToString(lnk_Lkp_CustKy_out.UPDATE_DT),'yyyy-mm-dd hh:nn:ss')


I have date so If I convert it into string
I might get for eg 1999-11-05 is the date
and the corresponding string is "1999-11-05"

could you pls help me

thanks

Posted: Wed Oct 31, 2007 8:14 pm
by ArndW
karrisuresh wrote:...could you pls help me...

I'm trying to. Just do it bit by bit. What is the string output from my last post's suggestion? Is what you posted your result or just what you think the result ought to look like?

date to string them string to timestamp

Posted: Wed Oct 31, 2007 9:41 pm
by changming
It should work. I used few days ago. Check your format %yyyy-%mm-%dd

Posted: Wed Oct 31, 2007 9:47 pm
by ArndW
changming - of course it cannot work. Which is why I am trying to get get the original poster to confirm his output.

hint: 1999-11-05 does not match the timestamp pattern 'yyyy-mm-dd hh:nn:ss'