Metadata dates/times and timezone


(Bdebroglio) #1

Puzzled...

 

This %asset_metadata_DCTERMS.date.expire% returns the expected value, the date/time entered in the metadata screen e.g. 2014-10-27EST18:00:00+1100

 

However, adding a keyword modifier returns a different date/time...%asset_metadata_DCTERMS.date.expire^date_format:l j F Y g.ia% returns Tuesday 28 October 2014 10.00am

 

I would like the keyword modifier to return Monday 27 October 2014 6pm


(Tom Chadwin) #2

Could be a timezone issue. Is the modifier ignoring the EST declaration? Does the correct date in EST equal the incorrect date in GMT?


(Benjamin Pearson) #3

It looks like the problem is the EST in the middle of the date, it should be just 'T' (you already have the timezone info on the end).


(Bdebroglio) #4

Thanks Tom, Ben.

 

I had a look at the metadata asset. The 'display format' was set to 'Y-m-dTH:i:sO'

 

Unfortunately, 'T' is a formatting keyword that returns 'timezone setting of this machine'. Hence 'EST' as well as GMT offset '+1100'

 

By changing the 'display format' to 'Y-m-d H:i:s' I get the result I want.

 

Thanks again.


(Benjamin Pearson) #5

Ahh in that case, you might be able to use: Y-m-d\TH:i:sO


(Bdebroglio) #6

Even better, thanks Ben


(Bart Banda) #7

You can just use "c", which will print the same thing (ISO 8601 date). Added in PHP5 as per: http://php.net/manual/en/function.date.php 


(Benjamin Pearson) #8

You can just use "c", which will print the same thing (ISO 8601 date). Added in PHP5 as per: http://php.net/manual/en/function.date.php 

Yes, that would work as well, but slightly different to the format originally quoted :)