• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

specifically why is time different on different servers

<?php
$row->real_timestamp='1392598061';
echo ' '.date("D", $row->real_timestamp);
echo'<br>'.date("M j, g:i A", $row->real_timestamp);

Open in new window


one server has output
Mon
Feb 17, 12:47 AM


another server
Warning: Creating default object from empty value in C:\wamp\www\test\real_timestamp.php on line 2
Sun
Feb 16, 7:47 PM

I have simplified this code because I am selecting mysql field and I have to add different numbers in order to show the real time.

I am looking for a specific reason why this occurs and not a link to php time.
0
rgb192
Asked:
rgb192
  • 2
1 Solution
 
Ray PaseurCommented:
The difference is almost certainly due to the PHP Timezone settings.  You can check this by printing out the return value from date_default_timezone_get().
0
 
rgb192Author Commented:
timezone_set at the top of the code

thanks
0
 
Ray PaseurCommented:
You can also set the timezone as a PHP initialization setting, which makes sense because the server will rarely change time zones -- they are related to geography.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now