https://github.com/tengattack/jodatime
A Go's time.Parse and time.Format replacement supports joda time format.
https://github.com/tengattack/jodatime
Last synced: about 1 year ago
JSON representation
A Go's time.Parse and time.Format replacement supports joda time format.
- Host: GitHub
- URL: https://github.com/tengattack/jodatime
- Owner: tengattack
- License: mit
- Created: 2018-09-19T11:49:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-20T00:08:37.000Z (over 7 years ago)
- Last Synced: 2025-02-10T02:18:48.459Z (over 1 year ago)
- Language: Go
- Size: 12.7 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jodatime
[](https://godoc.org/github.com/tengattack/jodatime)
[](https://travis-ci.org/tengattack/jodatime)
[](https://coveralls.io/github/tengattack/jodatime?branch=master)
[](http:/goreportcard.com/report/tengattack/jodatime)
A [Go](https://golang.org/)'s `time.Parse` and `time.Format` replacement supports [joda time](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html) format.
## Introduction
Golang developers refuse to support arbitrary format of fractional seconds:
[#27746](https://github.com/golang/go/issues/27746), [#26002](https://github.com/golang/go/issues/26002), [#6189](https://github.com/golang/go/issues/6189)
So, we can use this package to parse those fractional seconds not in standard format.
## Usage
```go
package main
import (
"fmt"
"time"
"github.com/tengattack/jodatime"
)
func main() {
date := jodatime.Format(time.Now(), "YYYY.MM.dd")
fmt.Println(date)
dateTime, _ := jodatime.Parse("YYYY-MM-dd HH:mm:ss,SSS", "2018-09-19 19:50:26,208")
fmt.Println(dateTime.String())
}
```
## Format
[http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html](http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html)
## License
MIT