Hi,

I have the following dates, either:

- 07-09-09 (which is 7th September 2009)
or
- 07/09/2009 (which is again 7th September 2009)

I need to reformat whichever one of these formats comes up so it
is correctly inserted into myql db via php.

Have tried strpos to find - or / and conditionals to create array of m,y,d and then rejoin in US format in order to use strtotime and then reformat via date into Y-m-d for database.... but that kept crashing the script...i'm a novice so any ideas?

Thanks in advance.

never mind... syntax error by me.

dont store a text format date, store a timestamp
timestamp can output to any user's preference
takes only 10bytes to store date and time,
is easier to process for select from - to dates

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.