jeffrydell Posted August 13, 2007 Share Posted August 13, 2007 How do I take a date that was entered by a site visitor (format: mm/dd/yyyy) and convert it properly for storing in a MySQL date field? I figured out the MySQL to 'human' function: function dateshow($dbdate) { $m = substr($dbdate,6,2); $d = substr($dbdate,9,2); $y = substr($dbdate,1,4); return date("m/d/Y", mktime(0,0,0,$m,$d,$y)); } but don't understand what I need to do to 'send it back' to the table in a format that MySQL will 'like'. Thank you for your help! Quote Link to comment https://forums.phpfreaks.com/topic/64608-solved-storing-a-date-in-mysql/ 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.