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

excelize format time to a unexpected format, that is "01-02-06" #675

Closed
wsyzxcn opened this issue Jul 24, 2020 · 5 comments
Closed

excelize format time to a unexpected format, that is "01-02-06" #675

wsyzxcn opened this issue Jul 24, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@wsyzxcn
Copy link

wsyzxcn commented Jul 24, 2020

If i input a date in a cell, for example 2020/10/12, and read that cell by excelize, i will get a string of "12-10-20". As i follow the code of decode flow i found that excelize will transfer date type to a formatted string by function formtTime.
I think excelize is being too clever, Usually, we just want a raw value of time isn't it ?

@xuri xuri added the enhancement New feature or request label Jul 26, 2020
@AngangGuo
Copy link

Possible to get raw value or let us specify a date format ourselves.

@weiqiangxu
Copy link

Possible to get raw value or let us specify a date format ourselves.

how to get yyyy-mm-dd , when i
excelize.builtInNumFmt[14] = "yyyy-mm-dd"
it is not exported by package.

@weiqiangxu
Copy link

weiqiangxu commented Oct 14, 2020

最后我也只能对获取到的值 mm-dd-yy 转换为 yyyy-mm-dd

package main
import (
	"fmt"
	"time"
)
func main() {
    t, _ := time.ParseInLocation("01-02-06", "10-14-20", time.Local)
    fmt.Println(t.Format("2006-01-02"))
}

输出:
2020-10-14

@bluntdel
Copy link

最后我也只能对获取到的值 mm-dd-yy 转换为 yyyy-mm-dd

package main
import (
	"fmt"
	"time"
)
func main() {
    t, _ := time.ParseInLocation("01-02-06", "10-14-20", time.Local)
    fmt.Println(t.Format("2006-01-02"))
}

输出:
2020-10-14

You can not specify '10-14-20' is '10-14-2020' or '10-14-1920'

@xuri
Copy link
Member

xuri commented Jan 8, 2021

This issue similar to #660 and #759. I close this and merge it into issue #660 is still discussing this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants