I have a three part date ie the day, month, year and I want to place all this information into a column in my db table. This information is provided by the users as a POST. The problem is I don't know how to get the data from the three separate drop downs into one data value maintaining the original format it was POSTED in. ie 22nd September 1986.
Please help..

And thanks everyone for your appropriate welcome.

9 Years
Discussion Span
Last Post by scru

Assuming the month is a string and the others are integers:

if(($date = strtotime("$day $month $year")) === true){
  $db->insertintodateintcol($date); //$date is an integer timestamp

To get the date and reformat it:

$date = db->getfromdateintcol();
$formatted_str = date("jS F Y", $date);
echo $formatted_str;

The code above makes assumptions:
$year, $month and $day are taken from their $_POST values (cleaned up, hopefully);
$date is a UNIX timestamp;
the methods of the fictional $db object are synonyms for your equivalent implementations;
the date column in the database table is of type int (or similar) with enough width to hold a unix timestamp.)

Read up on the following if you may:
Unix timestamps
PHP's strtotime
PHP's date

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.