LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   xls2csv doesn' t work with excel date format. (https://www.linuxquestions.org/questions/red-hat-31/xls2csv-doesn-t-work-with-excel-date-format-703348/)

zebela 02-09-2009 09:17 AM

xls2csv doesn' t work with excel date format.
 
When I use xls2csv (part of catdoc package) it can't handle dates. -f
switch is supposed to help, but does not work fine.

25/07/2008 becomes "26/07/12" :(
with

Quote:

xls2csv -f%d/%m/%y <file_name>
Can anybody help ?

Alain.

TB0ne 02-09-2009 11:11 AM

Quote:

Originally Posted by zebela (Post 3437183)
When I use xls2csv (part of catdoc package) it can't handle dates. -f
switch is supposed to help, but does not work fine.

25/07/2008 becomes "26/07/12" :(
with



Can anybody help ?

Alain.


The -f will only work properly if you put in the right syntax, and doesn't implement the entire POSIX date/time set. Only a limited subset is supported. Chances are there's a syntax problem in your -f declaration.

zebela 02-10-2009 03:23 AM

Right syntax ?
 
Hi,

Code:

-f%d/%m/%y
seems to by the right syntax isn't it ?

with it, xls2csv adds always 4 years and one day to the date, any idea about that.

Thanks for help.

Alain.

steppnav 11-06-2009 01:27 PM

xls2csv returns a day count
 
xls2csv returns a day count. I determined that the corrsponding day count for the epoch (time_t 0) is 25568. That may be polluted by my timezone, but it's a start. I subtract that number from the day count returned by xls2csv. I convert that to seconds (time_t, duh!) and convert it from seconds to something we stupid humans use. The strftime.exe is a c program I've been using on *nix sytems for several years. See the manpage on strftime (time_t, tm structs, localtime, etc). As for getting the -f option in xls2csv to work, I haven't been able to.

PC - ~ >bc -l
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
40053 - 25568
14485
14485 * (60*60*24)
1251504000
quit
PC - ~ >source/c/strftime.exe 1251504000
2009 08 28 20 00 00 EDT


All times are GMT -5. The time now is 10:05 PM.