Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-02-14
2
Medium Priority
?
219 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 111

Accepted Solution

by:
Ray Paseur earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…
Suggested Courses

783 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