Welcome Guest, Not a member yet? Register   Sign In
Date formats
#1

[eluser]kidego32[/eluser]
Hello everyone,

I'm wondering how to handle date fields in my app. I'm storing various dates in a mysql database. The way I'm doing it now is to display the form to the user with the date field as three separate form elements. One for the month, day, and year. In the controller, I then concatenate the fields into a new $date variable, and add it to the $POST variable. I then pass this $POST variable to the model, and it stores it in the database. When I pull a record from the database, I do the reverse. I split the returned mysql date value into the month, day, and year, and add it the three new variables to the $data result array. This is returned to the controller, which then calls the view.

I'm wondering if there is a more elegant or efficient method to handle dates?


Messages In This Thread
Date formats - by El Forum - 07-15-2008, 01:44 PM
Date formats - by El Forum - 07-15-2008, 08:22 PM
Date formats - by El Forum - 07-16-2008, 12:38 AM
Date formats - by El Forum - 07-16-2008, 09:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB