Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Extracting date from date & time

Hi all,

I am new to Qlikview and hope to get some guidance.

I have a dimension datetime that looks like this:

Format:DD/MM/YYYY HH:MM

8/17/2015 7:05

15/17/2015 19:05

How could I extract the date DD/MM/YYYY from it?

7 Replies
sunny_talwar

15/17/2015? What kind of date is this? Typo? May be try this

Date(Floor(TimeStamp#(DateField, 'DD/MM/YYYY hh:mm')), 'DD/MM/YYYY') as Date

Chanty4u
MVP
MVP

Hi try this

a:

LOAD * Inline

[

Dates

8/17/2015 7:05

12/17/2015 19:05

];

Result:

load *,

Date(Date#(Dates,'M/DD/YYYY hh:mm'),'DD/MM/YYYY') as NewDate

Resident a;date.PNG

Not applicable
Author

Hi chanty4u‌,

I tried your method and it works great. Thanks for helping.

Not applicable
Author

Apologies, i made a typo in the 2nd date. Thanks for your help Sunny.

sunny_talwar

I would suggest you not to use this without a Floor function.... because if you don't add Floor, the date might look like just the date, but the underlying value is still a timestamp. What that means is that if you have more than one timestamp for a single day, those will repeat in the list box.... Use this

Date(Floor(TimeStamp#(DateField, 'DD/MM/YYYY hh:mm')), 'DD/MM/YYYY') as Date

or this based on your timestamp format

Date(Floor(TimeStamp#(DateField, 'M/D/YYYY hh:mm')), 'DD/MM/YYYY') as Date

Anonymous
Not applicable
Author

Agree with Sunny.  I think you can also use the DayStart function.

sunny_talwar

Or even DayName()

dayname ‒ QlikView