>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'

----- Original Message -----
From: "olinux" <[EMAIL PROTECTED]>
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

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to