SOLVED: Changed to Unix date format, now I don't know how to just show the last months entries. - 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: SOLVED: Changed to Unix date format, now I don't know how to just show the last months entries. (/showthread.php?tid=11571) |
SOLVED: Changed to Unix date format, now I don't know how to just show the last months entries. - El Forum - 09-14-2008 [eluser]Joakim_[/eluser] Hello. Since I switched to store the dates in unix format I have run into a problem. Before I stored the dates as "m/d/Y" and could filter to show only the last months entries with the code below: Code: $this->db->where('MONTH(entry_date)', date("m",strtotime("-1 month"))); Now this code wont work. Anyone know how to edit this code to work with unix time stamp stored in the db? Thanks a lot! SOLVED: Changed to Unix date format, now I don't know how to just show the last months entries. - El Forum - 09-14-2008 [eluser]Pascal Kriete[/eluser] I think something like this should do the trick: Code: $this->db->where('entry_date >', strtotime("-1 month") ); SOLVED: Changed to Unix date format, now I don't know how to just show the last months entries. - El Forum - 09-14-2008 [eluser]Joakim_[/eluser] [quote author="inparo" date="1221429864"]I think something like this should do the trick: Code: $this->db->where('entry_date >', strtotime("-1 month") ); Awesome! It working when using "<". Thank you a lot. |