I am using a library called Custom Metaboxes and Fields for Wordpress to add meta data to my custom post types. It's an event website.
I had it all going, but started to have issues with sorting when trying to filter the adjacent_post_links
from singe posts.
I figured it might be that I am storing the date in m/d/y and not Y/m/d.
So, i've started over trying to work with a UNIX date timestamp as I have read this is the way to go. Now, I am having issues with my custom wp_queries
pulling my filtered posts on the front page. I think it has to do with needing to work with timezones.
Anyways, over the long run, what are the best practices in storing date in mysql? I've also been reading about using STR_TO_Date()
to properly format date so that you can order and compare dates if needed. Would this be an option if I went back to dates being stored in m/d/y .
Thanks
If you store dates as Unix timestamps in the database, it 'll gives you lots of trouble because it is not easily readable.for Example(unix format): '1410738238'
if you store as datetime format in the database, it is easy readable efficient and very flexiable,also mysql provides a lot of date functions.for Example(datetime format): '1970-01-01 00:00:01'
for more information http://dev.mysql.com/doc/refman/5.1/en/datetime.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.