user29772
user29772

Reputation: 1477

Date and time input

How can I show a date popup box that formats the date so it will fit in the mySQL date field?

Also, how can I check or format time to fit in the mySQL time field?

Upvotes: 1

Views: 1013

Answers (2)

Ward Werbrouck
Ward Werbrouck

Reputation: 1462

$mysqldate = date( 'Y-m-d H:i:s', $phpdate );
$phpdate = strtotime( $mysqldate );

edit:

This and Everything else about date/time in PHP, and how to use it with MySQL, is in the wonderful PHP documentation:

http://be.php.net/datetime

Upvotes: 6

Boden
Boden

Reputation: 4167

It sounds like you're looking for some kind of widget to allow the user to enter date & time. See this stack overflow thread.

Upvotes: 1

Related Questions