FAQ

 

How can I store a date ?

Suggested variant:
Save the date as timestamp in an int field. Before you display the data you just have to convert it into a date.
When using this solution, sorting works automatically correctly.

Other variant:
.. save the date as string, for example in a format like yyyymmdd, for example 20030203. The sorting works also correctly
when you use such a format (because the year comes before the month which comes before the day).
You may want to convert the stored value before showing it also.
Maybe a format like yyyy-mm-dd is even more simple to parse.

If you don't want to make operations on the stored date (like plus 1 day), you could also just save the
return value of date("D M j H:i:s Y") as string and display/overwrite it unconverted. This may be usefull for
a guestbook or a forum, etc.