MySQL Forums
Forum List  »  Newbie

Re: Timestamp trouble
Posted by: Daniel Louis
Date: January 06, 2015 12:45AM

Hi.

I created two columns:

a "Date" column with a VARCHAR(45) datatype and
a "Date_time" column with a TIMESTAMP datatype and CURRENT_TIMESTAMP as the default value(? I'm not sure if I'm getting the terms correct.)

I then created a form with a hidden text field that inserts the current date and time using the DATE function into a MySQL table when submitted.

This is the script I'm using as the text field's default value:

date_default_timezone_set("America/New_York");

echo date("m/d/y h:ia")

The DATE column in the table displays the correct day and time: 01/06/15 1:42am
the DATE_time column only displays the correct time but the day is off by 5,000 or so days: 2001-06-15 01:42:00.

I'm not getting it.

Options: ReplyQuote


Subject
Written By
Posted
January 03, 2015 04:43PM
January 03, 2015 04:45PM
January 05, 2015 11:14AM
Re: Timestamp trouble
January 06, 2015 12:45AM
January 06, 2015 03:24AM
January 06, 2015 11:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.