Re: Parse Question Using list()

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

 



cool@xxxxxxxxxxxxxxxx wrote:

On Oct 1, 2009, at 5:02 PM, Ben Dunlap wrote:

You could tackle this in a couple of different ways. Either split your
string into an array first:

$line = fgets($handle);
$columns = explode(",", trim($line));

Thanks Ben - the explode() command worked great!


Use the tool that PHP provides for such problems.

http://php.net/fgetcsv

---------

Now a bit of another problem

I'm exporting from another database (mac) to a csv file then a quick import to excel 2004 (mac) for some cleaning...

before the excel import, some date fields look like "2009-9-29 11:21:37" = good for sql import

but excel does an auto reformat to

9/29/2009  11:21:37 AM = not good for sql import


Q: any way to turn this auto reformat off in excel and keep it the way I had it? (I saw nothing in pref's)


try using strtotime() on that field and see if it works.

http://php.net/strtotime

I'm pretty sure that function will handle it.


Thanks,
cool@xxxxxxxxxxxxxxxx








--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux