Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date format change

Hello everyone,

I have a problem with dates.

One table I load from an external source contains date: 2015-05-12 (so: YYYY-MM-DD), but the main table we use contains: DATUM 12-05-2015 (so DD-MM-YYYY).

How can I load date as DATUM and consequently change it to the right format?

Thanks in advance.

1 Solution

Accepted Solutions
sunny_talwar

For your external source date you can do something like below to change to the main table's date format:

Date(Date#(ExternalSourceDateField, 'YYYY-MM-DD'), 'DD-MM-YYYY') as ExternalSourceDateField

I am guessing that what you are looking for? Let us know otherwise

Best,

Sunny

View solution in original post

5 Replies
sunny_talwar

For your external source date you can do something like below to change to the main table's date format:

Date(Date#(ExternalSourceDateField, 'YYYY-MM-DD'), 'DD-MM-YYYY') as ExternalSourceDateField

I am guessing that what you are looking for? Let us know otherwise

Best,

Sunny

rubenmarin

Hi Maarten, you can use the Date#() funtion, wich would read dates with the format you specify, and the use Date() to set the format you want ie:

LOAD Date(Date#('2015-05-10', 'YYYY-MM-DD'), 'DD-MM-YYYY') as Datum

....

Anonymous
Not applicable
Author

You can format date on load

LOAD
date(date#(DateField, 'YYYY-MM-DD')) as Date
From external source;

LOAD
date(date#(DATUMd, 'DD-MM-YYYY')) as Date
SELECT
...
FROM main table;

Not applicable
Author

Hi Maartes, you can do:

LOAD

DATUM,

Date#(DateOfExternalSource,'DD-MM-YYYY') as RightFormat

from [External_Source]

I hope that help it!

Regards, Agustín

Not applicable
Author

This answer worked, but I guess all the other answers are in the same context. Thank you!