LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 02-09-2009, 09:17 AM   #1
zebela
LQ Newbie
 
Registered: May 2008
Posts: 7

Rep: Reputation: 0
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.
 
Old 02-09-2009, 11:11 AM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,469

Rep: Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538Reputation: 2538
Quote:
Originally Posted by zebela View Post
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.
 
Old 02-10-2009, 03:23 AM   #3
zebela
LQ Newbie
 
Registered: May 2008
Posts: 7

Original Poster
Rep: Reputation: 0
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.
 
Old 11-06-2009, 01:27 PM   #4
steppnav
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need library for generating excel files format linuxsavar Programming 1 04-06-2008 02:30 PM
perl + excel + reading date values kshkid Programming 6 02-14-2008 01:13 PM
Excel Module - perl scripting - specifying encoding format kshkid Programming 2 11-06-2007 10:52 PM
Microphone doesn' work Lars79 Slackware 20 08-30-2005 09:24 AM
python doesn´t work little_ball Linux - Newbie 4 12-04-2004 09:09 AM


All times are GMT -5. The time now is 11:41 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration