String To Timestamp

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
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

String To Timestamp

Post by reddy »

Hi,

I have a datefield (01/25/2008) stored as a Varchar. I need to convert it into Timestamp 19 format with hh:mm:ss as 00:00:00. I went through different threads and tried different things. Everytime i get ***** as out put. Can anyone please help me? Thanks in advance.


Reddy.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

When column In.Datefield is '01/25/2008' then the derivation is

Code: Select all

StringToTimestamp(In.Datefield:' 00:00:00','%dd/%mm/%yyyy %hh:%nn:%ss')
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

I am able to convert 01/01/2008 to 2008-01-01 00:00:00 but surprisingly it returns ******* for 01/25/2008. Can anyone explain? Thanks.

reddy
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

I am able to convert 01/01/2008 to 2008-01-01 00:00:00 but surprisingly it returns ******* for 01/25/2008. Can anyone explain? Thanks.

reddy
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

99% likely because your explicit (or implicit) mask starts off with %dd/%mm!
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Can you please tell me the solution for this problem? Thanks.


Reddy
jmarutz
Participant
Posts: 5
Joined: Mon Jun 26, 2006 12:42 pm

Post by jmarutz »

It's like ArndW said, your job/project format default settings have the timestamp format of day then month (%dd/%mm) You can either change them to be month then day (%mm/%dd) or you can explicitly state the format of your date field in the transformer like ArndW previously posted.
Post Reply