[PHP-DB] inserting a timestamp

2001-04-18 Thread olinux

hey all,
I am having a hell of a time getting a timestamp to insert correctly. it keeps coming 
up 00

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 0

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






Re: [PHP-DB] inserting a timestamp

2001-04-18 Thread rjones

Olinux,
From the Mysql Manual

As a string with no delimiters in either 'MMDDHHMMSS' 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 '-00-00 00:00:00'

rwj
- Original Message -
From: "olinux" [EMAIL PROTECTED]
To: "PHP-DB" [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 00

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 0

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






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