Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

convert year format in script

Hi All,

I have date format as 3/15/0017 11:52:58 PM in my data set.

I wanna see it as 3/15/2017 11:52:58 PM


Can someone please help?

4 Replies
antoniotiman
Master III
Master III

Hi Mark,

may be

Timestamp(Timestamp#(Date,'M/D/00YY hh:mm:ss TT'),'M/D/YYYY hh:mm:ss TT') 

=Timestamp(Timestamp#('3/15/0017 11:52:58 PM','M/D/00YY hh:mm:ss TT'),'M/D/YYYY hh:mm:ss TT') 

Regards,

Antonio

markgraham123
Specialist
Specialist
Author

This is not working for all fields Antonio.

Actual data set is like this - Combination of normal and other data type!

3/15/0017 11:52:58 PM

3/16/2017 11:52:58 PM

3/17/0017 11:52:58 PM

3/18/2017 11:52:58 PM

3/19/0017 11:52:58 PM

3/22/2017 11:52:58 PM

3/23/2017 11:52:58 PM

3/30/2017 11:52:58 PM

antoniotiman
Master III
Master III

LOAD Alt(Timestamp(Timestamp#(Date,'M/D/00YY hh:mm:ss TT'),'M/D/YYYY hh:mm:ss TT'),Timestamp(Timestamp#(Date,'M/D/YYYY hh:mm:ss TT'),'M/D/YYYY hh:mm:ss TT'))  as Date

vishsaggi
Champion III
Champion III

Write an IF condition with Antonio's timestamp function.

Like:

= IF(Left(Subfield('31/02/0017', '/',3), 2) = '00', Timestamp(Timestamp#('3/15/0017 11:52:58 PM','M/D/00YY hh:mm:ss TT'),'M/D/YYYY hh:mm:ss TT') , yourdatefield)