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: 
jlampard40
Contributor III
Contributor III

Change date format from DD/MM/YYYY HH:MM to just DD/MM/YYYY

Hi - how can I change the date format from:

DD/MM/YYYY HH:MM to just DD/MM/YYYY

example:

27/11/2019 09:43 to 27/11/2019

Preferably within script itself.  Thought about using something lines of:

date(floor(timestamp([AD_Event_DT])),'DD/MM/YYYY')

but this doesn't work. 

Where AD_Event_DT is the field I need to use for Event Date. 

Thanks guys.

Labels (3)
4 Replies
atoz1158
Creator II
Creator II

Hi

I would normally use the following which has always worked for me

Date(Floor([AD_Event_DT]),'DD/MM/YYYY')

Cheers

Adrian

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Or maybe try this:

date#(left(Datestamp,index(Datestamp,' ')),'DD/MM/YYYYY')as [Event Date]

jlampard40
Contributor III
Contributor III
Author

Hi - this works:

 

DATE(timestamp#(AD_Event_DT,'DD/MM/YYYY hh:mm')) as Event_Date

 

BUT, when I try to plot the event date as dimension on a graph, it is not reflecting properly i.e. for each different variation of DD/MM/YYYY hh:mm it's counting as a single instance, rather than summing all of the instances up altogether?

For example - events on 04/12/2019 should be 15 in total.  However, the graph is displaying it as 15 individual instances of 04/12/2019 with differing hh:mm's!  How can I resolve this?

Thanks.

Brett_Bleess
Former Employee
Former Employee

Here are a couple of Design Blog posts that I believe may help:

https://community.qlik.com/t5/Qlik-Design-Blog/The-Date-Function/ba-p/1463157

https://community.qlik.com/t5/Qlik-Design-Blog/Why-don-t-my-dates-work/ba-p/1465849

I believe the problem is you left off the formatting you wanted with the DATE function:

DATE(timestamp#(AD_Event_DT,'DD/MM/YYYY hh:mm')'DD/MM/YYYY') as Event_Date

That will drop the hh:mm piece, which I think is what you really want...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.