Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I have Date field with different formats:
JAN 1 2018 12:00AM
2018-02-01
2018/03/01
How to convert in one form of date ?
Hi here is one document i have created for this case
Hi here is one document i have created for this case
Thanks for the document.
But Still for JAN 1 2018 12:00AM , I tried Date(alt(TimeStamp#(FromDate,'MMM DD YYYY hh:mmTT')),'DD-MM-YYYY').
It is not working
Try this
Date:
load *,
date(alt( date#( date1 , 'YYYY-MM-DD' ),
timestamp#(date1,'MMM D YYYY hh:mmTT'),
date#(date1 , 'YYYY/MM/DD' ),'NO' )) as NewDate;
LOAD * inline [date1
JAN 1 2018 12:00AM
2018-02-01
2018/03/01];
Hi,
Code: timestamp#(date1,'MMM D YYYY hh:mmTT') is not working for date format JAN 1 2018 12:00AM
The script posted by Gowtham works perfectly for the three cases that you posted in your question.
The only reason why it wouldn't work for you is maybe because you are using different source data. Can you post an example document with some sample data that isn't getting translated using this Alt() technique?
Peter
there was an extra space in timestamp date format . currently code is working fine
Date:
load *,
date(alt( date#( date1 , 'YYYY-MM-DD' ),
timestamp#(date1,'MMM D YYYY hh:mmTT'),
date#(date1 , 'YYYY/MM/DD' ),'NO' )) as NewDate;