Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a date field named ReportDate that is in format DD/MM/YYYY hh:mm:ss.
How can I format this to DD/MM/YYYY on my load statement?
Thanks
Daniel
Another thing I would suggest is to use a Floor function to truncate the time portion of the date
Date(Floor(DateField)) as Date
try
loiad *,
Date(Date#(Datefield,,'DD/MM/YYYY hh:mm:ss'),'DD/MM/YYYY') as newdate
resident table;
check sample:
a:
LOAD * Inline [
date
11/02/1991 01:12:55
];
Result:
load *,
Date(Date#(date,'DD/MM/YYYY hh:mm:ss'),'DD/MM/YYYY') as newdate
Resident a;
Another thing I would suggest is to use a Floor function to truncate the time portion of the date
Date(Floor(DateField)) as Date
To get a real date from a timestamp you need to cut the time-part, maybe in this way:
date(floor(ReportDate), 'DD/MM/YYYY')
and if ReportDate isn't regocnized as timestamp you need to convert it per timestamp#() like:
date(floor(timestamp#(ReportDate, 'DD/MM/YYYY hh:mm:ss')), 'DD/MM/YYYY')
- Marcus