Snooble Posted December 5, 2008 Share Posted December 5, 2008 I have a sql table... NUMBER DATE I insert, "5", "" I need the date of the insert to be put in. example: 21-5-2008 Is it possible to get SQL to datestamp it automatically? or should i generate the date in PHP and save it too? Snoobs Link to comment https://forums.phpfreaks.com/topic/135674-solved-timestamp-datestamp-mysql/ Share on other sites More sharing options...
JonnoTheDev Posted December 5, 2008 Share Posted December 5, 2008 yes INSERT INTO table SET datefield=CURDATE() Link to comment https://forums.phpfreaks.com/topic/135674-solved-timestamp-datestamp-mysql/#findComment-706861 Share on other sites More sharing options...
gevans Posted December 5, 2008 Share Posted December 5, 2008 Your best option is to use he linux timestamp time() //in php script or MYSQL functions, TIMEDATE() link Link to comment https://forums.phpfreaks.com/topic/135674-solved-timestamp-datestamp-mysql/#findComment-706862 Share on other sites More sharing options...
Mchl Posted December 5, 2008 Share Posted December 5, 2008 Use TIMESTAMP DEFAULT CURRENT_TIMESTAMP Link to comment https://forums.phpfreaks.com/topic/135674-solved-timestamp-datestamp-mysql/#findComment-706866 Share on other sites More sharing options...
Snooble Posted December 5, 2008 Author Share Posted December 5, 2008 So i alter the database? what type? and i need it to be DD-MM-YYYY. Snoobs Link to comment https://forums.phpfreaks.com/topic/135674-solved-timestamp-datestamp-mysql/#findComment-706871 Share on other sites More sharing options...
Mchl Posted December 5, 2008 Share Posted December 5, 2008 So i alter the database? what type? and i need it to be DD-MM-YYYY. Snoobs Read here about TIMESTAMP And no. You don't need it to be DD-MM-YYYY. You need to store it as a proper time format and be able to easily convert it to and from DD-MM-YYYY. Link to comment https://forums.phpfreaks.com/topic/135674-solved-timestamp-datestamp-mysql/#findComment-706873 Share on other sites More sharing options...
Snooble Posted December 5, 2008 Author Share Posted December 5, 2008 thank you.. SOLVED Link to comment https://forums.phpfreaks.com/topic/135674-solved-timestamp-datestamp-mysql/#findComment-706896 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.