Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert 19-Jul-2018 1:34PM to Date

I have a date field, example,

19-Jul-2018 1:34PM

and I would like to convert to

07/19/2018

How would this be most easily accomplished in load script?

1 Solution

Accepted Solutions
vamsee
Specialist
Specialist

Hello,

Date(Floor(Timestamp#('19-Jul-2018 1:34PM', 'DD-MMM-YYYY hh:mmtt')))

if you need a preceding 0 in the month then change the variable edit script.

         

          SET DateFormat='MM/DD/YYYY';

                         or

          Date(Floor(Timestamp#('19-Jul-2018 1:34PM', 'DD-MMM-YYYY hh:mmtt')), 'MM/DD/YYYY')

Thanks.

View solution in original post

7 Replies
Chanty4u
MVP
MVP

TRY THIS

date(Date#(Datefield,'DD-MMM-YYYY hh:mmTT'),'DD/MM/YYYY')  as newdate

uroboros
Creator
Creator

Hi Dave, use Date(Date#('19-Jul-2018 1:34PM','DD-MMM-YYYY hh:mmtt'),'DD/MM/YYYY')

It should work. Regards!

Chanty4u
MVP
MVP

My bad

date(Date#(Datefield,'DD-MMM-YYYY hh:mmTT'),'MM/DD/YYYY')  as newdate

OR

date(Date#(Datefield,'19-Jul-2018 1:34PM'),'07/19/2018')  as newdate

MarioCenteno
Creator III
Creator III

Try

date#(date(Date_FIELD),'MM/DD/YYYY') as date

vamsee
Specialist
Specialist

Hello,

Date(Floor(Timestamp#('19-Jul-2018 1:34PM', 'DD-MMM-YYYY hh:mmtt')))

if you need a preceding 0 in the month then change the variable edit script.

         

          SET DateFormat='MM/DD/YYYY';

                         or

          Date(Floor(Timestamp#('19-Jul-2018 1:34PM', 'DD-MMM-YYYY hh:mmtt')), 'MM/DD/YYYY')

Thanks.

Anonymous
Not applicable
Author

Thank you kind sir!!!!!!!

vishsaggi
Champion III
Champion III

May be another way is like:

Date(Date#(Trim(Subfield(Timestmp, ' ',1)), 'DD-MMM-YYYY'),'MM/DD/YYYY') AS TimeID