otuatail Posted May 19, 2009 Share Posted May 19, 2009 Probably a none starter this. But I store my date using the time() function in a 10 char text field. I was wondering if I could do an SQL where date is > yesterday but would need to convert the time into a usable form. Is this possible? Desmond. Reason why I did this is because I could not store the date in MySQL date field WITH hh:mm:ss Link to comment https://forums.phpfreaks.com/topic/158780-time-to-getdate/ Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 Store it as a DATE field in format of YYYY-MM-DD If you just store hh:mm:ss, how can you tell if that's tomorrow, today, yesterday or even last year? Link to comment https://forums.phpfreaks.com/topic/158780-time-to-getdate/#findComment-837422 Share on other sites More sharing options...
otuatail Posted May 19, 2009 Author Share Posted May 19, 2009 I was only giving an indication of the problem. I have tried storing a date. If I have a date field and I store '2009/050/18 18:04:22' I get it in the database as '2009/050/18 hh:mm:ss NOW missing. is this ok? CREATE TABLE users ( users_id int NOT NULL auto_increment, name char(20), InsertDate datetime, PRIMARY KEY (users_id) ); INSERT INTO users (name , InsertDate) VALUES ('David' , NOW() ) select * from users where InsertDate > '2009/05/01' Link to comment https://forums.phpfreaks.com/topic/158780-time-to-getdate/#findComment-837439 Share on other sites More sharing options...
fenway Posted May 19, 2009 Share Posted May 19, 2009 That's a wildly misformated date. Link to comment https://forums.phpfreaks.com/topic/158780-time-to-getdate/#findComment-837457 Share on other sites More sharing options...
otuatail Posted May 19, 2009 Author Share Posted May 19, 2009 That meaning? Link to comment https://forums.phpfreaks.com/topic/158780-time-to-getdate/#findComment-837461 Share on other sites More sharing options...
fenway Posted May 19, 2009 Share Posted May 19, 2009 SQL-99 date format is YYYY-MM-DD HH:MM:SS. Link to comment https://forums.phpfreaks.com/topic/158780-time-to-getdate/#findComment-837495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.