Jump to content

date & time


poe

Recommended Posts

my web host is located on the west coast

 

i live on the east coast

 

so if my page shows the date:

 

$day = date(d);
$mth = date(m);
$yr = date(y);

echo $day . "-" . $mth . "-" . $yr;

 

i shows the date as of west coast time.

 

so the time now is 1:40am april 6, 2007

 

my page will still show april 5, since west coast is 3 hours back. (10:40pm apr 5)

 

how do i compensate for this time zone difference?

 

i want my time / date to always reflect eastern standard time.

Link to comment
https://forums.phpfreaks.com/topic/45678-date-time/
Share on other sites

Suppose the server is in west zone which is 12 hours + then your east zone

 

echo date("Y-m-d H:i:s",strtotime("-12 hours")); // Your east zone time

echo "<br>";

echo date("Y-m-d H:i:s",strtotime("now")); // Your server time

 

-----------------------------

<?php

echo strtotime("now"), "\n";

echo strtotime("10 September 2000"), "\n";

echo strtotime("+1 day"), "\n";

echo strtotime("+1 week"), "\n";

echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";

echo strtotime("next Thursday"), "\n";

echo strtotime("last Monday"), "\n";

?>

Link to comment
https://forums.phpfreaks.com/topic/45678-date-time/#findComment-221874
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.