# README
DateTime - Simple DateTime Engine for Go
Installation
To install the package, run:
go get github.com/go-zoox/datetime
Getting Started
fmt.Println(datetime.Now().Format("YYYY-MM-DD HH:mm:ss"))
// 2022-04-12 13:05:50
Inspired by
- zcorky/moment - A minimalist JavaScript library that parses, validates, manipulates, and displays dates and times.
- dayjs
- moment.js
License
GoZoox is released under the MIT License.
# Functions
FromDate returns a DateTime from a Date.
FromPattern returns a DateTime from a pattern(layout) and a datetime string.
FromTime returns a DateTime from time.Time.
New returns a DateTime Support:
1.
Now returns the time.Time of DateTime.
SetLanguage sets the language.
SetLocales is the week days.
SetTimeZone sets the global time zone of the datetime.
# Variables
AgoPattern is the pattern for Ago.
DefaultFormatPattern is the default format pattern.
Language is the language.
Locales is the locales.
LocalesWeekDays is the week days.
LocalesWeekDaysMin is the week days in minium.
LocalesWeekDaysShort is the week days in short.
TimeZoneForce will force to override datetime instance time zone
default is empty string, means no force time zone, use datetime self timezone, it is local timezone for example, set as Asia/Shanghai, Format will use Asia/Shanghai override internal time zone unless it has call SetTimeZone before.
Version is the version of this package.
# Structs
AgoOptions is the options for Ago.
DateTime is a struct that represents a datetime.