![]() |
Dealing with dates - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Dealing with dates (/showthread.php?tid=5615) |
Dealing with dates - El Forum - 01-28-2008 [eluser]fakeempire[/eluser] I'm working on an application that has "events" with a date. I'm trying to figure out the easiest and cleanest way to deal with the events. First I dont have any limitations or requirements so I'm not sure if the the unix timestamp is easier to work with or or mysql's datetime field. Really the only functionality I want is to be able to sort by month during a list -- ie February -[date & time] - Event Title A -[date & time] - Event Title B March [No Events] April -[date & time] - Event Title C I'm really just not sure how to go about it and which type of time would be best to use. Thanks guys Dealing with dates - El Forum - 01-28-2008 [eluser]Phil Sturgeon[/eluser] UNIX time or MySQL time both order fine. Pick one and just use: Code: $this->db->orderby('date'); If you think you will be doing lots of mathmatics on the date (getting items within the last 7 days, timespans, date format changes, etc) then use UNIX. If you want a simple "store and show" then use MySQL. Otherwise you will be converting back to UNIX every time you want to do some convertions. |