datatypes.Date to time.Time
- Dominant language
- Go
- Stars
- 831
- Forks
- 124
- PR merge metrics
- No merged PRs in 30d
Description
## Your Question
In the documentation it talks about how to go from time.Time to datatypes.Date() - insert a time into database.
Reference:
https://github.com/go-gorm/datatypes/
https://github.com/go-gorm/datatypes/blob/master/date.go
But to retrieve a date from the database and convert to time.Time, I searched quite a lot and tried different methods to go from datatypes.Date() to time.Time.
I got this to work but I'm sure its probably not the best method.
```golang
x, _ := dbrecord.Date.MarshalJSON()
bDate, _ := time.Parse(time.RFC3339, strings.Trim(string(x), "\""))
```
## The document you expected this should be explained
https://github.com/go-gorm/datatypes/
## Expected answer
It would be good to have best practice in the readme on how to do this.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.