coolgamer48 Posted December 31, 2007 Share Posted December 31, 2007 Hey, if I want to keep track of when a user signs up for a site, how would I translate the current date into a value SQL can understand (I'm using php btw). I already have a table with a value called date_est, and the datatype is date, but I don't know what SQL defines as a date? Does it want it in mm/dd/yyyy form or something? Link to comment Share on other sites More sharing options...
shiftJIS Posted December 31, 2007 Share Posted December 31, 2007 Assuming you're using MySQL...The documentation is your friend: ( http://dev.mysql.com/doc/refman/5.1/en/datetime.html )Of course, make sure you're reading the version that applies to the one being run on your server, although I can't think of any changes between the newer ones of the top of my head.In short, there are a LOT of formats you can use, and MySQL will interpret it based on context and even strip off extra data (like hour/minutes/seconds which don't get stored in DATE) automagically. You can even use date-time functions supported by MySQL ( http://dev.mysql.com/doc/refman/5.1/en/dat...ml#function_now ) directly in your queries so you don't have to mess with this stuff (ex. "UPDATE table_foo SET date_est=NOW() WHERE foo=1;") Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.