Page 1 of 1

Date format

Posted: Mon Sep 10, 2007 5:02 am
by scorpion
Hi All,

I used below code to populate in one of my target field as below format.

CCCC-MM-DD HH:MM:SS.

code is:

TimestampToString(StringToTimestamp(from_funnel.EFCTE_CLCLD_DTTM, "%yyyy%mm%dd %hh:%nn"), "%yyyy-%mm-%dd %hh:%nn:%ss")

but now my requirement is to poulate only 'CCCC-MM-DD' format,but not needed time.

where can i modify my code in my previous code.

Help should be appreciated.

Re: Date format

Posted: Mon Sep 10, 2007 5:33 am
by JoshGeorge
Code you specified also is finally making a string, so if you just want to modify, you can use substring function

Code: Select all

TimestampToString(StringToTimestamp(from_funnel.EFCTE_CLCLD_DTTM, "%yyyy%mm%dd %hh:%nn"), "%yyyy-%mm-%dd %hh:%nn:%ss")[1,10]


or else rewrite the code with conversions related to date instead of timestamp.

scorpion wrote: TimestampToString(StringToTimestamp(from_funnel.EFCTE_CLCLD_DTTM, "%yyyy%mm%dd %hh:%nn"), "%yyyy-%mm-%dd %hh:%nn:%ss")

but now my requirement is to poulate only 'CCCC-MM-DD' format,but not needed time.

where can i modify my code in my previous code.

Posted: Mon Sep 10, 2007 7:31 am
by scorpion
Hi JoshGeorge,

Thanks for the reply,I rewrite the code as below and it is working fine now..

DateToString(StringToDate(Left( from_funnel.EFCTE_CLCLD_DTTM, 8), "%yyyy%mm%dd"), "%yyyy-%mm-%dd")