Skip to main content
Announcements
Get Ready. A New Qlik Learning Experience is Coming February 17! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dosaril
Contributor III
Contributor III

Change a string to Date format

hello 

 

i have date format as the below screenshot and i try to convert it to dd-mm-yyyy , but it show no date when i use the following expression  :

Date(Date#(TRANSACTION_DATE, 'YYYY-MM-DD hh:mm:ss'), 'DD/MM/YYYY') AS Master_Calendar_Date_Num

dosaril_0-1738684901137.png

thanks 

 

4 Replies
marcus_sommer

It seems to be already interpreted as date and therefore the following should be enough:

Date(TRANSACTION_DATE, 'DD/MM/YYYY')

SRA
Partner - Contributor III
Partner - Contributor III

Hi,

Your TRANSACTION_DATE contains milliseconds, so I would use :

Date(Date#(TRANSACTION_DATE, 'YYYY-MM-DD hh:mm:ss.ms'), 'DD/MM/YYYY') AS Master_Calendar_Date_Num

Regards

 

andydietler
Partner - Creator
Partner - Creator

What you have is a timestamp. You can format it to look like a date but the underlying number is going to be a timestamp so it won't function like a dimension. What I would do first is remove the time portion using floor().

So something like Date(Floor(TRANSACTION_DATE), 'DD/MM/YYYY') AS Master_Calendar_Date_Num

Bhushan_Mahajan
Contributor III
Contributor III

@dosaril It is already a date, there is no need to use Date#. Use Date(floor(TRANSACTION_DATE), 'DD/MM/YYYY')