Jump to content

[SOLVED] Storing a date in MySQL


jeffrydell

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/64608-solved-storing-a-date-in-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.