Forums / General / datetime field

datetime field

Author Message

Carlos Revillo

Monday 30 January 2006 3:02:13 pm

hi. i'm working in a shared hosting. i'm in spain but shared hosting is in the usa. i use a datetime for one of my custom class, and i set "actual time" by default. but, as expected, actual time is taken from the server and not from my country. how can i "add eight hours" to that value?
I mean, when i create a new content object of this class at 23:00 in Spain, ez publish assigns to that datetime attribute the value [date] 17:00, and this is not what i want...

J-A Eberhard

Monday 30 January 2006 11:34:55 pm

You have to add the following line in index.php

if(date('T') != 'Europe/Madrid') putenv("TZ=Europe/Madrid");

just before this line

$scriptStartTime = microtime();

Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch

Carlos Revillo

Tuesday 31 January 2006 1:47:28 am

Thanks!. I was looking for another way (searching in ini fields looking for a config option or things like that) but what you say works for me.