Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.