Solved

unix timestamp is hardcoded in my table but appears different on different host (timezones)

Posted on 2014-02-14
2
192 Views
Last Modified: 2014-02-17
old code, will update soon because does not use pdo, mysqli
code uses mysql

$qfetch='SELECT * from email_doc';
$fetch=mysql_query($qfetch);
while ( $row = mysql_fetch_object( $fetch ) );



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


this is unix_timestamp which is unix_timestamp with an hour added



1379358861
1379359341
1379362620
1379445757
1379446700
1379448620
1379492114

these values are different on different servers.  Is there a way to set timestamp

I created another column and I need to add 4-6 hours depending upon which server I am hosting information even though value is hardcoded in datebase table.
0
Comment
Question by:rgb192
2 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39859408
Please read the article here.  Look for the part about PHP and MySQL Have Different Time Zone Settings (but please read the entire article - it has background information you need in order to understand what you're getting into!)
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html
0
 

Author Closing Comment

by:rgb192
ID: 39865470
I have read the article and I do not know why this specifically occurs so I have created a question with more details and testing.  Thanks for the information.
0

Featured Post

IT, Stop Being Called Into Every Meeting

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

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
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…

743 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

11 Experts available now in Live!

Get 1:1 Help Now