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? Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.