SQL have one field i.e. Date

My application's UI have three drop down

  1. Day
  2. Month
  3. Year

I inserted its value using CONCAT

$c3date=  @trim(stripslashes($_POST['c3year']. '-' . $_POST['c3month'] . '-' . $_POST['c3day']));

and values are stored in Database.

How can I view the 'Day', 'Month' and 'Year'? I need separate values of 'Day', 'Month' and 'Year'.

  • Ananth, I understand that you're using phpunit, but this does seem like a general php programming question. I'll ping the SO mods to see if they'd accept this.
    – corsiKa
    Oct 8, 2015 at 19:42
  • So this is indeed off-topic and would be migrated to SO. But it would get closed as a duplicate of stackoverflow.com/q/9054998/330057 so I'll just point you there and close this here.
    – corsiKa
    Oct 8, 2015 at 19:46

1 Answer 1


If your date field value is stored in a field of SQL Database (as mentioned by you), then you can view the same using simple SQL queries either using Datepart (Month, Date) or Select YEAR (YourDate), MONTH (YourDate), DAY (YourDate);

both will return you the desired values.

  • How can retrieve the values in php from sql..Php have three separate drop down fields are Day, month, year,but sql i stored value is Date Oct 10, 2015 at 15:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.