We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Split data in form

Hello!

I'm working on some form where I have three select elements for birth day, month and year. The problem is that I created single field called date in database and I would like to split it everytime when form loads from Y-m-d to select fields for year, month and day.

Is that possible and if it's, how to do it?

Thank you!



33.8k

Try to var_dump() the date you receive from the DB, then do a explode based on the delimiter you need to use.

More info: https://stackoverflow.com/questions/7103617/simple-question-how-to-split-date-08-17-2011-into-month-day-year-php