Cyberspace Posted April 6, 2008 Share Posted April 6, 2008 Really simple question - I need to store the current date in a MYSQL database, i dont want to use a timestamp storing the date and time, how i can i set the field to store only the date when i record is added? Link to comment https://forums.phpfreaks.com/topic/99801-mysql-storing-a-date/ Share on other sites More sharing options...
DanielWhite Posted April 6, 2008 Share Posted April 6, 2008 Try storing date("??") Change ?? with the letters from here: http://uk3.php.net/date Link to comment https://forums.phpfreaks.com/topic/99801-mysql-storing-a-date/#findComment-510430 Share on other sites More sharing options...
AndyB Posted April 6, 2008 Share Posted April 6, 2008 use yyyy-mm-dd as the format for storing your date. Use whatever format you want for displaying dates retrieved from the database. Link to comment https://forums.phpfreaks.com/topic/99801-mysql-storing-a-date/#findComment-510432 Share on other sites More sharing options...
bozebo Posted April 6, 2008 Share Posted April 6, 2008 well, seeing as you hate timestamps theres not much you can do that allows easy manipulation, andyb's suggestion is very good though. yyyy-mm-dd is the international standard for dates and it is good for verification and manipulation. using some good regular expressions and the php function: strtotime() along with date("Y-m-d") will allow you to achieve this Link to comment https://forums.phpfreaks.com/topic/99801-mysql-storing-a-date/#findComment-510494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.