Nitestarz78 Posted September 5, 2012 Share Posted September 5, 2012 I have a form where a user fills in the date of their choice for a seminar. This is in UK format. The form displays the results on the thank you page as well as emails me the information, from which I submit into my db. How can I get the date to change to US format when it is mailed to me? Please let me know if you need any additional information. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 5, 2012 Share Posted September 5, 2012 Your best bet is to use a datepicker, and have your code format the date rather than allowing the user to do it. Quote Link to comment Share on other sites More sharing options...
Nitestarz78 Posted September 5, 2012 Author Share Posted September 5, 2012 The problem with that is that there are literally hundreds of different dates for different seminars. They have to put the date in. The form is not powered from any sort of db. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2012 Share Posted September 5, 2012 Sounds like a good project to take on then. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 5, 2012 Share Posted September 5, 2012 Do you know what a datepicker is? You know, like when you click on the date field and a little calendar pops up so you can pick the date. Google Jquery datepicker, and there are lots of examples. Quote Link to comment Share on other sites More sharing options...
Nitestarz78 Posted September 5, 2012 Author Share Posted September 5, 2012 Yes, I know what datepicker is. How could that be converted from UK to US when the form is submitted? The site will never be DB powered, that is just the way it is unfortunately. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2012 Share Posted September 5, 2012 A datepicker has nothing to do with a database, and you would convert the date using PHP. Quote Link to comment Share on other sites More sharing options...
Nitestarz78 Posted September 5, 2012 Author Share Posted September 5, 2012 How could it be converted with php? That is essentially my whole problem. I cant figure out how to convert it. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted September 5, 2012 Share Posted September 5, 2012 It doesn't really matter how to convert it. When the user has control over the format, there is no consistency, thus it's nearly impossible to write code to account for all the possibilities. Most datepickers not only present users with a uniform method of selection, they allow you to configure the format in which the data is sent from the form. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2012 Share Posted September 5, 2012 http://forums.phpfreaks.com/index.php?topic=360863 http://forums.phpfreaks.com/index.php?topic=265172 There's another one where someone was trying to do it all in one line, but this should be enough to get you started 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.