• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
best practice: model or controller?

I am taking a mySQL date (2008-07-02) and breaking it apart to populate form elements, one for year, one for month and one for day using strtok function. Question: is it best practice to split the date in the model function or in the controller function, or is this an either/or thing? Currently I'm splitting the date in the controller.

It's really how you like it best. If you only need to do this once, you could keep it in your controller, if you need to do this several times, Don't Repeat Yourself (DRY, keep that in mind Wink) and put it in a library, model or helper, whatever suits your needs.

Thanks! DRY == KISS? ;-)

KISS? Never heard off... As I'm guessing you're not referring to the band.

[eluser]Pascal Kriete[/eluser]
Keep it simple, stupid. They're related, but not the same Smile .

to get back on topic why not break it in sql
Quote:SELECT day( date ) day ,
month( date ) month ,
year( date ) year
FROM table

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.