I have an application that serializes uploaded files by datetime of
upload.
This may not be the most efficient, but this will yield a MySQL
DATETIME type string:
$datetime = date("YmdHis");
If you are looking for a DATE column and a TIME column seperately
(not recomended . . . use logic to parse the TIME and DATE parts of a
DATETIME column) thet you will need to use
$myDate = date("Ymd"); //year,month,day with preceeding zeros
$myTime = date("His"); //hours,minutes,seconds with preceeding
zeros
I have not checked the documentation for these: check the DATE and
TIME column type requirements in MySQL, and the date() function in PHP.
Obviously, make sure your MySQL column data type is DATETIME, and
that you single quote the $datetime value since it's considered text. Here
is my SQL string:
$sql="INSERT INTO $docMaster (
sqDocID,
sqUID,
sqSubmitDate,
sqDocAnon,
sqRequestID,
sqHostID,
sqTitle,
sqCopies,
sqOptionStr,
sqFileName,
sqDocType,
Fsize,
ppFsize
)
VALUES (
NULL,
$uid,
'$datetime',
'$Anon',
'$request_id',
$sqHostID,
'$title',
$copies,
'$option_list',
'$file',
'$DocType',
$Fsize,
$tmpFsize
)";
It should be obvious by now that I am making a PHP4/CGI shell script
LP print filter.
This filter intercepts incoming print streams, then converts
postscript to PDF or compresses PCL, moves the result to a controlled
directory structure, and then logs to database.
A little Apache with PHP with MySQL later, and I have a hands-off
paperless queueing system. I love OpenSource!
Any interest from the PHP community in seeing this effort released?
I'm developing on Solaris for production use on Solaris, and have noted some
incompatabilities with Linux, FWIW.
John T. Foley
Network Administrator
Pollak Engineered Products, Actuator Products Division, A Stoneridge
Company
195 Freeport Street, Boston MA 02122
ph: (617) 474-7266 fax: (617) 282-9058
The geographical center of Boston is in Roxbury. Due north of
the center we find the South End. This is not to be confused with South
Boston which lies directly east from the South End. North of the South
End is East Boston and southwest of East Boston is the North End.
> -----Original Message-----
> From: Zenith [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, February 28, 2000 1:16 PM
> To: [EMAIL PROTECTED]
> Subject: How to insert time and date into mysql?
>
> How can I insert time and date into mysql table,
> if the table i have to insert has a field of type time, and a field of
> type
> date.
>
> Then how can I insert it in PHP, if I use time() function??
>
>
--
PHP General 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]