/    Sign up×
Community /Pin to ProfileBookmark

Change the time zone

I would like to change the time zone of my site, for mysql / javascript, the whole thing.

I’ve asked my host if they can do it and they say it has to be set at their local time.

Is there any way I can change it, .htaccess? or something in php?

Thanks for your help!

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@bokehAug 25.2006 — [URL=http://www.php.net/setlocale]setlocale()[/URL]
Copy linkTweet thisAlerts:
@NogDogAug 25.2006 — [URL=http://www.php.net/setlocale]setlocale()[/URL][/QUOTE]
I don't believe you can set the time zone with setlocale(), just the names of months and days that will be used based on the applicable language.

If using PHP 5.1.0 or later, you can use date_default_timezone_set(). Otherwise, I believe you'll just have to do some date/time arithmetic. For instance, if you want the displayed time to be 3 hours behind the server time:
[code=php]
echo date('Y/m/d H:i:s', strtotime("-3 hours"));
[/code]
Copy linkTweet thisAlerts:
@bokehAug 25.2006 — I don't believe you can set the time zone with setlocale()[/QUOTE]Yes you're right! [code=php]putenv('TZ=Europe/Madrid');[/code]
Copy linkTweet thisAlerts:
@aerodudeauthorAug 26.2006 — Ooh thanks, putenv() of course!
×

Success!

Help @aerodude spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...