Custom Fields
Re-Envisioned
Support MB Custom Table Date format between custom field and database field Reply To: Date format between custom field and database field

#13879

Anh Tran
Keymaster

According to MySQL docs:

The TIMESTAMP syntax produces a DATETIME value in MySQL because DATETIME has a range that more closely corresponds to the standard SQL TIMESTAMP type, which has a year range from 0001 to 9999.

That means TIMESTAMP has the exact format as DATETIME, which is Y-m-d H:i:s. It’s not the same as the Unix timestamp as we use in PHP.

And saving date with format Y-m-d still makes it sortable. So, it’s okay to set the column type to DATETIME and set the save_format as Y-m-d.