By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,724 Members | 1,391 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,724 IT Pros & Developers. It's quick & easy.

PHP Equivalent of MySQL STR_TO_DATE()?

P: n/a

I have an application where I would like to be able to allow the user
to specify the date format used throughout the program (for
internationalization).

Then, on a date entry field, I can specify the date format on a MySQL
SELECT to get the date in the proper format.

The Javascript date selector I am using allows me to specify the
format for selecting the date.

Where I am having problems is posting the date back to MySQL. If I was
using v4 of MySQL, I could use STR_TO_DATE(). However, I need to be
able to support version 3 of MySQL, so I need a PHP equivalent to
convert the date in the user-defined format to the MySQL date format.

I can use date() to get a timestamp into the proper format, but how do
I get the user-defined format into a timestamp? strtotime() was the
closest I could find, but that doesn't look like it is going to work
for any format.

Has anyone else run into this? Is there a solution?

--Bruce

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Bruce <bv***************@mailblocks.com> wrote in message news:<on********************************@4ax.com>. ..
<snip>
I can use date() to get a timestamp into the proper format, but how do
I get the user-defined format into a timestamp? strtotime() was the
closest I could find, but that doesn't look like it is going to work
for any format.


May try <http://www.phpinsider.com/php/code/Date_Calc/>

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.