View Full Version : date

10-13-2004, 08:13 AM
how would i be able to insert the date into my database if i have 3 dropdown boxes wherein it contain the month,day & year. i know the basic of inserting data into my database but with this 3 dropdown box i don't have any idea. after submitting, the data selected on these 3 boxes shall be in one field in my database with fieldname Date . any sample codes for this one?

any help will be appreciated.

10-13-2004, 12:47 PM
Join them together like this... depending on the method of date you're using you could use different seperators.

$date = $month . '-' . $day . '-' . $year;

Then simply just put $date into your database field. :thumbsup:

10-13-2004, 12:53 PM
Record them as a timestamp into your database.

Oops, wanted some code examples:
Database format for column: INT 10 unsigned NOT NULL

$date = '14 October 2004';

$date = strtotime($date);

// This will record as a time stamp into the database. Extract with:

$date = date('F d Y', $yourquery['timestamp']);

Please note, you must follow GNU Date Syntax for this to correctly work.