/jodatime

A Go's time.Parse and time.Format replacement supports joda time format.

Primary LanguageGoMIT LicenseMIT

jodatime

GoDoc Build Status Coverage Status Go Report Card

A Go's time.Parse and time.Format replacement supports joda time format.

Introduction

Golang developers refuse to support arbitrary format of fractional seconds: #27746, #26002, #6189

So, we can use this package to parse those fractional seconds not in standard format.

Usage

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

License

MIT