• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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