XF 2.0 Convert database field YYYY-MM-DD to XF format


Active member
I don't fully understand how XF2 comes up with the date number. How would I convert a field formatted as YYYY-MM-DD to the XF2 format?


Well-known member
the long numbers are called a unix timestamp

to convert to something you can manipulate in MySQL, use the FROM_UNIXTIME function in your query

To go the other way, there is an equivalent UNIX_TIMESTAMP function - but be aware that translation between the two values is lossy in regards to timezone mapping (unixtime should generally be in GMT).

Alternatively, look at using a library like Carbon to make time format conversions and manipulation in PHP