richiec Posted May 8, 2009 Share Posted May 8, 2009 Hello all, im having a little issue here ill try and explain it best i can. I have a date and time stored in my database which is then read from a site if the date and time in the DB is < than the current date and time (meaning the current date has now passed the date in the DB) the site changes a little. I have it working, it works fine, apart from one thing.. This is the date and time in the DB: May 10, 2009, 15:52 Now today is the 8th and the site is thinking that the current date and time is > than the date and time in the DB because the date begins with 10 (first number being 1) The date field in the DB is using varchar i know to go by number order it would be int and it would then order them correctly however you can only have numbers in int. Does anyone know any way i can solve this issue? Thanks Rich Link to comment https://forums.phpfreaks.com/topic/157403-date/ Share on other sites More sharing options...
Mchl Posted May 8, 2009 Share Posted May 8, 2009 You've made a mistake by storing date as a literal string. You should store date and time using DATE, TIME, DATETIME or TIMESTAMP datatypes. http://dev.mysql.com/doc/refman/5.0/en/datetime.html This will make your life much easier. Link to comment https://forums.phpfreaks.com/topic/157403-date/#findComment-829843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.