Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetRows() method parses 12:20 PM as 00:20 AM, not consistent to ExcelDateToTime() method #1338

Closed
limingjie opened this issue Sep 2, 2022 · 2 comments
Labels
confirmed This issue can be reproduced

Comments

@limingjie
Copy link

limingjie commented Sep 2, 2022

Description

The excelize.File.GetRows method parses 12:20 PM as 00:20 AM, usually 12:20 PM is treated as 20 minutes past noon, which is 12:20 in 24-hour format.

Steps to reproduce the issue:

  1. In the Excel file, enter 1/2/23 12:20 PM in a cell, the cell is in Date format.
  2. Use excelize.File.GetRows(sheetName) method to get the rows.

Describe the results you received:
1/2/23 00:20 AM

Describe the results you expected:
1/2/23 12:20 PM

Workaround
There is a workaround.

  1. Get the rows in raw by excelize.File.GetRows(sheetName, excelize.Options{RawCellValue: true})
  2. Convert the float value by excelize.ExcelDateToTime(f, false) method.

Output of go version:

go version go1.18.3 darwin/arm64

Excelize version or commit ID:

v2.6.0

Environment details (OS, Microsoft Excel™ version, physical, etc.):
macOS Monterey 12.5.1

@xuri xuri added needs more info This issue can't reproduce, need more info confirmed This issue can be reproduced and removed needs more info This issue can't reproduce, need more info labels Sep 3, 2022
@xuri xuri closed this as completed in 00470c1 Sep 3, 2022
@xuri
Copy link
Member

xuri commented Sep 3, 2022

Thanks for your feedback. This issue has been fixed, please upgrade to the master branch code, and this patch will be released in the next version.

@limingjie
Copy link
Author

Thank you @xuri for the quick turnaround!

xuri added a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed This issue can be reproduced
Projects
None yet
Development

No branches or pull requests

2 participants