Re: inserting a timestamp

From: Date: Thu, 19 Apr 2001 02:42:19 +0000
Subject: Re: inserting a timestamp
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-8683@lists.php.net to get a copy of this message
Olinux, From the Mysql Manual As a string with no delimiters in either 'YYYYMMDDHHMMSS' or 'YYMMDDHHMMSS' format, provided that the string makes sense as a date. For example, '19970523091528' and '970523091528' are interpreted as '1997-05-23 09:15:28', but '971122129015' is illegal (it has a nonsensical minute part) and becomes '0000-00-00 00:00:00' rwj ----- Original Message ----- From: "olinux" <olnx@yahoo.com> To: "PHP-DB" <php-db@lists.php.net> Sent: Thursday, April 19, 2001 12:12 AM Subject: [PHP-DB] inserting a timestamp hey all, I am having a hell of a time getting a timestamp to insert correctly. it keeps coming up 00000000000000 here's what i have $date_avail = mktime (0,0,0,$month,$day,$year); $avail = date("F j, Y", $date_avail); echo "Date Available: $avail"; this works fine and displays the date correctly My insert statement is fine [no mistakes] I insert $date_avail into the date_avail field which is type TIMESTAMP - when i inserti get a 0000000000000 If i change the field type of date_avail to VARCHAR it inserts correctly and i can reference it as a timestamp and display correctly [a mysql db] can anyone help, i guess that using varchar is fine, but i have wasted a half a day and am a little pissed about this. I noticed that even when i try to change the date_avail field with phpmyadmin to NOT NULL it changes to NULL - i think that this is the prob, but i do not know thanks much olinux

« previous php.db (#8683) next »