brechtsanders / xlsxio

XLSX I/O - C library for reading and writing .xlsx files
MIT License
425 stars 113 forks source link

date-time conversion using xlsx to csv converter #5

Open praogithub123 opened 8 years ago

praogithub123 commented 8 years ago

First of all, thanks for developing this application. It is very useful. I compiled the code in Ubuntu 14.04 and ran the xlsxio_xlsx2csv program on an xlsx file. The first column of the file consists of a date string in the format mm/dd/yyyy hh:mm:ss. The csv file appears to contain Microsoft timestamps. See attached zip file containing xlsx and csv files. For example, 1/1/2014 00:00:00 gets converted to 41640. It would be useful to dump out the time stamp as a string or have the option of getting a linux time stamp. Thanks. 0.zip

brechtsanders commented 8 years ago

Hi,

Thanks for your example.

I am aware the library doesn't actually detect the type of data at this time. That is why the C library has functions like xlsxioread_sheet_next_cell_datetime() which allow you to actually read a Unix timestamp value.

In your example I see the first column has cells defined as:

which refers to cellXfs: which in turn refers to numFmts: So even though there is a format string there, I can't really see anything actually saying it is a Windows timestamp value. Let me think about this for a bit, maybe I will come up with a solution. Make sure to check if a next version is released. Regards Brecht On 14/06/2016 21:55, Pranesh Rao wrote: > First of all, thanks for developing this application. It is very useful. > I compiled the code in Ubuntu 14.04 and ran the xlsxio_xlsx2csv > program on an xlsx file. The first column of the file consists of a > date string in the format mm/dd/yyyy hh:mm:ss. The csv file appears to > contain Microsoft timestamps. See attached zip file containing xlsx > and csv files. For example, 1/1/2014 00:00:00 gets converted to 41640. > It would be useful to dump out the time stamp as a string or have the > option of getting a linux time stamp. > Thanks. > 0.zip https://github.com/brechtsanders/xlsxio/files/314828/0.zip > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > https://github.com/brechtsanders/xlsxio/issues/5, or mute the thread > https://github.com/notifications/unsubscribe/AQ0-eSggqq3ahxHshPvyrLslIM3Lqi6Eks5qLwcVgaJpZM4I1sos.