qazplm114477 14 Junior Poster

I was just wondering if there was a more optimal way to add dates to mysql if I had a drop down for each field. This is the code I use to format the dates

$date_hired = format_date($_POST['month_datehired'], trim($_POST['date_datehired']), $_POST['year_datehired']); 


//I have 3 dropdowns in my form, 1 for months, 1 for dates, and 1 for year.

//And to retrieve them for Updates, I need a really long query

$query="select DATE_FORMAT(date_hired, '%m')as months_date_hired, DATE_FORMAT(date_hired,'%d')as dates_date_hired, DATE_FORMAT(date_hired, '%Y') as years_date_hired from etc";

so if there was a simpler or better way to do this, I would love to hear it. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.