Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change date format

Hello all,

My data currently has the date listed in the following format:

Jan 29, 2017 22:01:46 EST

I'm trying to change it so it only has 1/29/2017 with no time stamp. How would I accomplish this?

Also, I'm trying to set an expression for when the date is within the last 14 days, display all the data with severity = 'high'

thank you in advance!

22 Replies
sunny_talwar

May be like this

LOAD Date(Floor(TimeStamp#(SubField(DateField, ' EST', 1), 'MMM DD, YYYY hh:mm:ss'))) as Date

vishsaggi
Champion III
Champion III

Try this?

Replace the date with you datefield name.

=  Date(Date#(Replace('Jan 29, 2017 22:01:46 EST', Right('Jan 29, 2017 22:01:46 EST', 12), ' ') , 'MMM DD, YYYY'), 'MM/DD/YYYY')

OR

=  Date(Date#(Replace('Datefield', Right('Datefield', 12), ' ') , 'MMM DD, YYYY'), 'MM/DD/YYYY')

aarkay29
Specialist
Specialist

Above Sunny's expression for Date

Date(Floor(TimeStamp#(Trim(SubField(DateField, ' EST', 1)), 'MMM DD, YYYY hh:mm:ss')))  As Date


For Severity Flag

if(Date>=Date(today()-14),'High') as [Severity Flag]

Not applicable
Author

This works, but there's also 'EDT', so all those dates with EDT are blank, how do I fix that?

sunny_talwar

May be try this:

Date(Floor(TimeStamp#(SubField(DateField, ' E', 1), 'MMM DD, YYYY hh:mm:ss'))) as Date

aarkay29
Specialist
Specialist

Try This

Date(Floor(TimeStamp#(Trim( Left(DateField,Len(DateField)-3)), 'MMM DD, YYYY hh:mm:ss')))

Not applicable
Author

hm, severity flag isn't working. this is how i was thinking to try it, but it didnt work for me:

if(New_first_discovered>=Date(today()-14) AND New_Severity = 'High'

aarkay29
Specialist
Specialist

what are you exactly trying to achieve and also Is New_first_discovered in Date format  ??

Not applicable
Author

This worked for the date issue, thanks