Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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
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
....
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;
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
This answer worked, but I guess all the other answers are in the same context. Thank you!