Jump to content

strtotime


kreut

Recommended Posts

Hello!

 

A user is going to input a date in the form "mm/dd/yyyy".  I'd like to convert this to a time stamp so that I can store it via MySql.  I've heard about the "strtotime" function in PHP but I'm not sure how it can tell that the user 03/04/2011 represents March,4th 2011 and not, say April,3rd 2011 (European version).  Help with the correct syntax for conversion would be greatly appreciated.

 

Thank you,

 

Eric

Link to comment
https://forums.phpfreaks.com/topic/231188-strtotime/
Share on other sites

Why would you need to do that? If it's going into a MySQL database, you should be able to set up the datepicker so it sends the date pre-formatted as YYYY-MM-DD in the $_POST array. Then all you have to do is validate it and insert it.

Link to comment
https://forums.phpfreaks.com/topic/231188-strtotime/#findComment-1190099
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.