RE: Time'n Date trouble - format pain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> As my nightmare comes true I have to input CSV files into a MySQL DB.
> 
> The Date(time) format can differ in 3 different ways:
> - - MM/DD/YYYY e.g. 06/25/2002
> - - DD/MM/YYYY e.g. 17/03/2003

You're pretty screwed on those two. If you have 03/04/2003, is it MM/DD
or DD/MM ??? Can't tell... 

> ... AND ...
> - - "Sat, 19 Apr 2003 12:57:23 +0200" :(((
> Do you have some hint for me how I can avoid a pain of explode()s and
> endless parsing?

Strtotime() will give you a unix timestamp for the second and third
formats, I think. You can then convert that into a MySQL timestamp using
date. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux