beginner
beginner

Reputation: 2032

Current timestamp is different from current date

I have this table.

+------------------+--------------+------+-----+-------------------+-
| Field            | Type         | Null | Key | Default           |
+------------------+--------------+------+-----+-------------------+-
| encoded_date     | timestamp    | NO   |     | CURRENT_TIMESTAMP |
| actual_date      | date         | NO   |     | NULL              |
+------------------+--------------+------+-----+-------------------+-

My computer's date is 5/14/2015 10:10Am.. Why is it that when I submit the form, the record being save is

Encoded Date: 2015-05-13 18:59:03

Upvotes: 0

Views: 169

Answers (1)

user1392897
user1392897

Reputation: 851

Try setting the timezone at the top of your form page like this:

<?php
    //set time zone
    date_default_timezone_set('America/New_York');
?>

You can find whatever timezone you are in here: http://php.net/manual/en/timezones.php

Upvotes: 2

Related Questions