943,582 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 446
  • PHP RSS
Sep 9th, 2009
0

UK date insertion into mysql db problem

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rayarman is offline Offline
12 posts
since Sep 2009
Sep 9th, 2009
0

Re: UK date insertion into mysql db problem

never mind... syntax error by me.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rayarman is offline Offline
12 posts
since Sep 2009
Sep 9th, 2009
0

Re: UK date insertion into mysql db problem

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
Reputation Points: 562
Solved Threads: 367
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Parse error
Next Thread in PHP Forum Timeline: mobile redirect





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC