Solved

specifically why is time different on different servers

Posted on 2014-02-17
3
155 Views
Last Modified: 2014-02-17
<?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
Comment
Question by:rgb192
  • 2
3 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39865489
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
 

Author Closing Comment

by:rgb192
ID: 39865552
timezone_set at the top of the code

thanks
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 39865564
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now