yarekGmail
asked on
php : time transformations
Hello experts
I have a server hosted in US.
When I use: date("Y-m-d H:i");
It returns the local server time which is GMT-5
My question is : how can I get the time from Paris (+1 hour) ?
Regards
I have a server hosted in US.
When I use: date("Y-m-d H:i");
It returns the local server time which is GMT-5
My question is : how can I get the time from Paris (+1 hour) ?
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Have a look here: http://www.php.net/manual/en/function.date.php
specifically at the Timezone section:
Timezone --- ---
e Timezone identifier (added in PHP 5.1.0) Examples: UTC, GMT, Atlantic/Azores
I (capital i) Whether or not the date is in daylight saving time 1 if Daylight Saving Time, 0 otherwise.
O Difference to Greenwich time (GMT) in hours Example: +0200
P Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3) Example: +02:00
T Timezone abbreviation Examples: EST, MDT ...
Z Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. -43200 through 50400
You can also have a look here: http://www.php.net/manual/en/function.date-default-timezone-set.php
specifically at the Timezone section:
Timezone --- ---
e Timezone identifier (added in PHP 5.1.0) Examples: UTC, GMT, Atlantic/Azores
I (capital i) Whether or not the date is in daylight saving time 1 if Daylight Saving Time, 0 otherwise.
O Difference to Greenwich time (GMT) in hours Example: +0200
P Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3) Example: +02:00
T Timezone abbreviation Examples: EST, MDT ...
Z Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. -43200 through 50400
You can also have a look here: http://www.php.net/manual/en/function.date-default-timezone-set.php
Rik-Legger is correct. This article explains how it all works. See the first code snippet.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html
Open in new window