UK date insertion into mysql db problem

Thread Solved

Join Date: Sep 2009
Posts: 7
Reputation: rayarman is an unknown quantity at this point 
Solved Threads: 0
rayarman rayarman is offline Offline
Newbie Poster

UK date insertion into mysql db problem

 
0
  #1
Sep 9th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 7
Reputation: rayarman is an unknown quantity at this point 
Solved Threads: 0
rayarman rayarman is offline Offline
Newbie Poster

Re: UK date insertion into mysql db problem

 
0
  #2
Sep 9th, 2009
never mind... syntax error by me.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,365
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 164
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: UK date insertion into mysql db problem

 
0
  #3
Sep 9th, 2009
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
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC