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

Document that "Z" is trimmed when parsing time #1125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emersion
Copy link

No description provided.

@rittneje
Copy link
Collaborator

@mattn The current behavior is actually pretty strange. Right now this library doesn't even support timezones (other than Z) for any format other than the first two.

Probably we should remove the part where it chops off Z and fix the list of formats to:

var SQLiteTimestampFormats = []string{
	"2006-01-02 15:04:05.999999999Z07:00",
	"2006-01-02 15:04:05.999999999",
	"2006-01-02T15:04:05.999999999Z07:00",
	"2006-01-02T15:04:05.999999999",
	"2006-01-02 15:04:05Z07:00",
	"2006-01-02 15:04:05",
	"2006-01-02T15:04:05Z07:00",
	"2006-01-02T15:04:05",
	"2006-01-02 15:04Z07:00",
	"2006-01-02 15:04",
	"2006-01-02T15:04Z07:00",
	"2006-01-02T15:04",
	"2006-01-02Z07:00",
	"2006-01-02",
}

However, that could get into some interesting questions wrt backwards compatibility.

It would also be worth mentioning that if the parsed timestamp does not include time zone information it will assume UTC (and not local).

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

Successfully merging this pull request may close these issues.

2 participants