Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have a spreadsheet with the date data as 3/16/2015 (to be read M/DD/YYYY)
How can I format this in the load script to load in as DD/MM/YYYY so each month will be a double digit number?
gwassenaar does the order of Date#(Date(...)) matter? I feel that shouldn't the second MyNewDate be like this?
LOAD
Date(Date#(MyExcelDate, 'M/DD/YYYY'),'DD/MM/YYYY') as MyNewDate
FROM ....
Let me know if it doesn't matter.
Best,
Sunny
change the script:
Date( YourTimeDimension, 'DD/MM/YYYY') as YourTimeDimension,
Excel dates are often already numeric values with date formatting. In that case you only need the date() function:
LOAD
date(MyExcelDate, 'DD/MM/YYYY') as MyNewDate
FROM ....
But if the excel values are string values then you also need the date#() function:
LOAD
date(date#(MyExcelDate, 'M/DD/YYYY'),'DD/MM/YYYY') as MyNewDate
FROM ....
Date(Date#(DateField,'M/DD/YYYY'),'DD/MM/YYYY') as DateField
Refer to this document for the date formatting
gwassenaar does the order of Date#(Date(...)) matter? I feel that shouldn't the second MyNewDate be like this?
LOAD
Date(Date#(MyExcelDate, 'M/DD/YYYY'),'DD/MM/YYYY') as MyNewDate
FROM ....
Let me know if it doesn't matter.
Best,
Sunny
Many thanks!! Date(Date#.......worked like a charm!!
Yes, you're totally right. Thanks for pointing out my error.
That was more sort of a question than to point out your error. But I am glad it served both the purposes
Best,
Sunny