Problem with dates parsing #279
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#279
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have a xlsx file with different date formats, all of which are interpreted as Date type by Excel (2016, Mac). I need to parse these kind of values to native js date objects, but unfortunately js-xlsx interprets them as Number type, see following outputs. I am using js-xlsx v0.8.0 with node v0.12.2. Is it expected behaviour ? How can I parse it to native date objects ?
Outputs:
Output of sheet_to_json with raw = true :
Hello,
In my case I just add my format date (dd/mm/yyyy) in table_fmt array in xlsx.js file
I don't understand . please show me the code....
@varunoberoi see https://github.com/SheetJS/js-xlsx/issues/126 for further information
var utc_value = Math.floor(your_number- 25569) * 86400;
var date_info = new Date(utc_value * 1000);
var month = parseInt(date_info.getMonth()) + 1;
newDate = date_info.getFullYear() + "/" + month + "/" + date_info.getDate();
@pushpenderjunglee that works like a charm, but can you explain a little bit about the magic numbers there?
@andrevenancio Excel stores timestamps as a real number representing the number of days since 1 January 1900.
25569 is the number of days between 1 January 1900 and 1 January 1970, which is what we need to convert to a UNIX timestamp that can be used for Date.