ccrevcypsys Posted November 21, 2007 Share Posted November 21, 2007 I have a CURRENT_TIMESTAMP on my table and i just want to display the date and not the time. How would i do that? Link to comment https://forums.phpfreaks.com/topic/78302-how-do-i-n00b-question/ Share on other sites More sharing options...
revraz Posted November 21, 2007 Share Posted November 21, 2007 Using MySQL? I use a function function formatDate($val) { $arr = explode ('-', $val); return date ('d M Y', mktime (0,0,0,$arr[1], $arr[2], $arr[0])); } This takes a MySQL NOW date/time and only displays the date. Link to comment https://forums.phpfreaks.com/topic/78302-how-do-i-n00b-question/#findComment-396217 Share on other sites More sharing options...
premiso Posted November 21, 2007 Share Posted November 21, 2007 An easier solution is using the mysql TO_DATE function (google it) and pull it out how you want it, or www.php.net/strtotime which converts most dates into a unix time stamp to avoid the nasty ness of mktime() and explode function. <?php function formatDate($val) { return date ('d M Y', strtotime($val)); } ?> Adds a bit more efficiency I guess, either way should work. Link to comment https://forums.phpfreaks.com/topic/78302-how-do-i-n00b-question/#findComment-396274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.