Re: inserting date from text file

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

 



From: "Aleks @ USA.net" <Aleks.k@usa.net>

> I have a large text file that I am inserting into a mysql db and seem to
> have a problem with
> the date format. The data is currently in the mm/dd/yyyy format.

MySQL expects a YYYYMMDD or YYYY-MM-DD format (the delimiter for the string
version can be any character, actually)

> I am using phpMyAdmin with the above command. I have over 1000 lines of
data
> to add and
> changing all the dates would be a royal pain. Is the note a way to set the
> format in the
> column description to allow for the current data format to remain as is
and
> have the
> db insert the date in the correct mySQL format??

There's no way to set a format. You could insert them into a VARCHAR column,
then use an UPDATE query to pull the string apart and format it into
YYYYMMDD and update another DATE column, though.

Or have PHP run pre-process your text file and change the dates for you
(since this is a PHP list. :))

---John Holmes...

-- 
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