Solved

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

Posted on 2014-02-14
2
197 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 109

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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why do people dis php? 5 50
PHP Installer 5 24
How would I do this...? 2 28
How is this connection happening? 3 15
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

773 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