Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
Hope all r doing well.
I have date as Apr 1 2021 03:34 AM in my field.
I want it in standard date format DD/MMM/YYYY that is 01/Apr/2021
How to achieve this.
Thanks in advance.
Hi try this
load * ,
Date(Date#('Apr 1 2021 03:34 AM','MMM D YYYY hh:mm TT'),'DD/MMM/YYYY') as NewDate;
LOAD * INLINE [
Date
Apr 1 2021 03:34 AM
];
exit SCRIPT;
And if in case date is Apr 12 2021 03:34 AM
Then What should do ?
Hi @dhavalvyas
The Solution @Chanty4u suggested will work.
Did u try it before replying ? please test it from your side then post the question or reply and be considerate.
hope this clears your doubt and if it is resolved please make sure to give the replier like and mark it as solved.
Thanks and Regards
Kashyap.R
Hi Kashyap,
Thanks for your suggestion.i tried it, however
it is not working as per my requirement.
HI
please attach a sample file with ur date inputs
Regards
Kashyap.R
Please find attached file.
just add other D
load * ,
Date(Date#('Apr 1 2021 03:34 AM','MMM DD YYYY hh:mm TT'),'DD/MMM/YYYY') as NewDate;
LOAD * INLINE [
Date
Apr 12 2021 03:34 AM
];
Still not working.
Hi @dhavalvyas
The problem is with the datetime field you are getting it is having 24 hour format and it also has AM/PM
please use either one of the below expression hope it will solve the issue.
Date(Timestamp#(Replace(Replace(Date,'AM',''),'PM',''),'MMM DD YYYY hh:mm'),'DD/MMM/YYYY')
or
Date(Date#(
Replace(Replace(
Timestamp#(Date,'MMM DD YYYY hh:mm TT'),'AM',''),'PM',''),'MMM DD YYYY hh:mm'),'DD/MMM/YYYY')
have a nice day
Thanks and Regards
Kashyap.R