Date format

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

Date format

Post 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.
Thanx&Regards
scorpion
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Re: Date format

Post 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.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

Post 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")
Thanx&Regards
scorpion
Post Reply