samona Posted June 2, 2008 Share Posted June 2, 2008 Hi All, I was wondering what is the best function to use when you want to store the Date a record is inserted. I was using NOW(), but it's difficult to try to get the month/day/year out of it when trying to retrieve a record that was created on a particular month/day/year. Is there any other function that works better than NOW() that should be used? Link to comment https://forums.phpfreaks.com/topic/108371-now-or-better/ Share on other sites More sharing options...
BlueSkyIS Posted June 2, 2008 Share Posted June 2, 2008 your problem is the field type, not how you're inserting data. what type of field are you inserting into? timestamp, date, date-time or other? Link to comment https://forums.phpfreaks.com/topic/108371-now-or-better/#findComment-555549 Share on other sites More sharing options...
samona Posted June 2, 2008 Author Share Posted June 2, 2008 I'm inserting NOW() into a DATETIME field Link to comment https://forums.phpfreaks.com/topic/108371-now-or-better/#findComment-555556 Share on other sites More sharing options...
PFMaBiSmAd Posted June 2, 2008 Share Posted June 2, 2008 To format a DATETIME field in any format you want when you SELECT it, use the mysql DATE_FORMAT() function in your query - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format Link to comment https://forums.phpfreaks.com/topic/108371-now-or-better/#findComment-555568 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.