gostradamus

package module
Version: v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 4 Imported by: 3

README

Gostradamus logo

Gostradamus: Better DateTimes for Go

Gostradamus Go Report Card go.dev reference

Introduction

Gostradamus is a Go library that offers a lightweight and human-friendly way to create, transform, format, and parse datetimes. It uses the underlying Go time library and the main gostradamus' type DateTime can be easily converted to and from time.Time.

Gostradamus is named after the french pharmacist Nostradamus. He is known for his prophecies, therefore he worked a lot with time, like Gostradamus.

Features

✅ Easy conversion from existing time.Time objects to gostradamus.DateTime and back

✅ Timezone-aware and UTC by default

✅ Timezone conversion

✅ Generates time spans, floors, ceilings from second to year

✅ Weeks manipulation

✅ Format with common and known format tokens like YYYY-MM-DD HH:mm:ss

Basic Usage

package main

import "github.com/bykof/gostradamus"

func main() {
    dateTime, err := gostradamus.Parse("2017-07-14T02:40:00.000000", gostradamus.Iso8601)
    if err != nil {
        panic(err)
    }

    dateTime = dateTime.ShiftMonths(-5).ShiftDays(2)
    println(dateTime.Format("DD.MM.YYYY HH:mm:ss"))
    // 16.02.2017 02:40:00
}

Table of Contents

Usage

This part introduces all basic features of gostradamus. Surely there are more, just look them up in the offical documentation.

Types

There are two types in this package, which are important to know:

type DateTime time.Time
type Timezone string

DateTime contains all the creation, transforming, formatting and parsing functions.

Timezone is just a string type but gostradamus has all timezones defined as constants. Look here.

Conversion between time.Time and gostradamus.DateTime

You can easily convert between gostradamus.DateTime and time.Time package. Either with helper functions or with golang's type conversion

import "time"

// From gostradamus.DateTime to time.Time
dateTime := gostradamus.Now()
firstTime := dateTime.Time()
secondTime := time.Time(dateTime)

// From time.Time to gostradamus.DateTime
t := time.Now()
dateTime = gostradamus.DateTimeFromTime(t)
dateTime = gostradamus.DateTime(t)
Creation

If you want to create a gostradamus.DateTime you have several ways:

Just create the DateTime from scratch:

// Create it with a defined timezone as you know it
dateTime := gostradamus.NewDateTime(2020, 1, 1, 12, 0, 0, 0, gostradamus.EuropeBerlin)

// Create it with predefined UTC timezone
dateTime := gostradamus.NewUTCDateTime(2020, 1, 1, 12, 0, 0, 0)

// Create it with local timzone
dateTime := gostradamus.NewLocalDateTime(2020, 1, 1, 12, 0, 0, 0)

Or create a DateTime from an ISO-8601 format:

dateTime := gostradamus.Parse("2017-07-14T02:40:00.000000+0200", gostradamus.Iso8601)

Or from a custom format:

dateTime := gostradamus.Parse("10.02.2010 14:59:53", "DD.MM.YYYY HH:mm:ss")

Or an UNIX timestamp for example:

dateTime := gostradamus.FromUnixTimestamp(1500000000)

Or different ways of the current datetime:

// Current DateTime in local timezone
dateTime := gostradamus.Now()

// Current DateTime in UTC timezone
dateTime = gostradamus.UTCNow()

// Current DateTime in given timezone
dateTime = gostradamus.NowInTimezone(gostradamus.EuropeParis)
Timezones

Feel free to use all available timezones, defined here:

gostradamus.EuropeParis // Europe/Paris
gostradamus.EuropeBerlin // Europe/Berlin
gostradamus.AmericaNewYork // America/New_York
... and many more
Converting

Convert between timezones easily:

dateTime := gostradamus.NewUTC(2020, 1, 1, 12, 12, 12, 0).InTimezone(gostradamus.EuropeBerlin)
println(dateTime.String())
// 2020-02-15T13:12:12.000000+0100

dateTime = dateTime.InTimeZone(America_New_York)
println(dateTime.String())
// 2020-02-15T07:12:12.000000-0500
Manipulating
Shift

Shifting helps you to add or subtract years, months, days, hours, minutes, seconds, milliseconds, microseconds, and nanoseconds.

To add a value use positive integer, to subtract use negative integer.

dateTime := gostradamus.NewUTCDateTime(2020, 1, 1, 1, 1, 1, 1)
dateTime = dateTime.ShiftYears(10)
println(dateTime.String())
// 2030-01-01T01:01:01.000000+0000

dateTime = gostradamus.NewUTCDateTime(2020, 1, 1, 1, 1, 1, 1)
dateTime = dateTime.ShiftDays(-10)
println(dateTime.String())
// 2019-12-22T01:01:01.000000+0000

dateTime = gostradamus.NewUTCDateTime(2020, 1, 1, 1, 1, 1, 1)
dateTime = dateTime.ShiftWeeks(2)
println(dateTime.String())
// 2020-01-15T01:01:01.000000+0000

dateTime = gostradamus.NewUTCDateTime(2020, 1, 1, 1, 1, 1, 1)
dateTime = dateTime.Shift(0, 1, 10, 0, 0, 0, 0)
println(dateTime.String())
// 2020-02-11T01:01:01.000000+0000
Replace

Replacing values can be done easily.

dateTime := gostradamus.NewUTCDateTime(2020, 1, 1, 1, 1, 1, 1)
dateTime = dateTime.ReplaceYear(2010)
println(dateTime.String())
// 2010-01-01T01:01:01.000000+0000

dateTime = gostradamus.NewUTCDateTime(2020, 1, 1, 1, 1, 1, 1)
dateTime = dateTime.ReplaceYear(2010).ReplaceMonth(2)
println(dateTime.String())
// 2010-02-01T01:01:01.000000+0000
Parsing + Formatting

Parse strings easily with well-known tokens.

Please consider that you cannot put custom tokens or custom letters into the parsing string

Token Table
Token Output
Year YYYY 2000, 2001, 2002 … 2012, 2013
YY 00, 01, 02 … 12, 13
Month MMMM January, February, March …
MMM Jan, Feb, Mar …
MM 01, 02, 03 … 11, 12
M 1, 2, 3 … 11, 12
Day of Year DDDD 001, 002, 003 … 364, 365
Day of Month DD 01, 02, 03 … 30, 31
D 1, 2, 3 … 30, 31
Day of Week dddd Monday, Tuesday, Wednesday …
ddd Mon, Tue, Wed …
Hour HH 00, 01, 02 … 23, 24
hh 01, 02, 03 … 11, 12
h 1, 2, 3 … 11, 12
AM / PM A AM, PM
a am, pm
Minute mm 00, 01, 02 … 58, 59
m 0, 1, 2 … 58, 59
Second ss 00, 01, 02 … 58, 59
s 0, 1, 2 … 58, 59
Microsecond S 000000 … 999999
Timezone ZZZ Asia/Baku, Europe/Warsaw, GMT
zz -07:00, -06:00 … +06:00, +07:00, +08, Z
Z -0700, -0600 … +0600, +0700, +08, Z
Parsing

Easily parse with Parse:

dateTime, err := gostradamus.Parse("10.02.2010 14:59:53", "DD.MM.YYYY HH:mm:ss")
println(dateTime.String())
// 2010-02-10T14:59:53.000000Z

You can also specify a timezone while parsing:

dateTime, err := gostradamus.ParseInTimezone("10.02.2010 14:59:53", "DD.MM.YYYY HH:mm:ss", gostradamus.EuropeBerlin)
println(dateTime.String())
// 2010-02-10T14:59:53.000000+0100
Formatting

Formatting is as easy as parsing:

dateTimeString := gostradamus.NewDateTime(2017, 7, 14, 2, 40, 0, 0, UTC).Format("DD.MM.YYYY Time: HH:mm:ss")
println(dateTimeString)
// 14.07.2017 Time: 02:40:00
Floor + Ceil

Sometimes you need quickly the start of current day or the last day of your DateTime's month.

That's why there is floor and ceil

Floor
dateTimeString := gostradamus.NewDateTime(2017, 7, 14, 2, 40, 0, 0, UTC).FloorDay()
println(dateTimeString.String())
// 2017-07-14T00:00:00.000000Z

dateTimeString := gostradamus.NewDateTime(2017, 7, 14, 2, 40, 0, 0, UTC).FlorHour()
println(dateTimeString.String())
// 2017-07-14T02:00:00.000000Z
Ceil
dateTimeString := gostradamus.NewDateTime(2017, 7, 14, 2, 40, 0, 0, UTC).CeilMonth()
println(dateTimeString.String())
// 2017-07-31T23:59:59.999999Z

dateTimeString := gostradamus.NewDateTime(2017, 7, 14, 2, 40, 0, 0, UTC).CeilSecond()
println(dateTimeString.String())
// 2017-07-14T02:40:00.999999Z
Spans

Spans can help you to get quickly the current span of the month or the day:

start, end := NewDateTime(2017, 7, 14, 2, 40, 0, 0, UTC).SpanMonth()
println(start.String())
// 2017-07-01T00:00:00.000000Z
println(end.String())
// 2017-07-31T23:59:59.999999Z

start, end = NewDateTime(2017, 7, 14, 2, 40, 0, 0, UTC).SpanDay()
println(start.String())
// 2017-07-14T00:00:00.000000Z
println(end.String())
// 2017-07-14T23:59:59.999999Z

start, end = NewDateTime(2012, 12, 12, 2, 40, 0, 0, UTC).SpanWeek()
println(start.String())
// 2012-12-10T00:00:00.000000Z
println(end.String())
// 2012-12-16T23:59:59.999999Z
Utils

Here is the section for some nice helper functions that will save you some time.

Is between
isBetween := gostradamus.NewUTCDateTime(2020, 1, 1, 12, 0, 0, 0).IsBetween(
	gostradamus.NewUTCDateTime(2020, 1, 1, 11, 0, 0, 0),
    gostradamus.NewUTCDateTime(2020, 1, 1, 13, 0, 0, 0), 
)
println(isBetween)
// true

isBetween = gostradamus.NewUTCDateTime(2020, 1, 1, 12, 0, 0, 0).IsBetween(
    gostradamus.NewUTCDateTime(2020, 1, 1, 13, 0, 0, 0),
    gostradamus.NewUTCDateTime(2020, 1, 1, 14, 0, 0, 0),
)
println(isBetween)
// false
Iso Calendar

Retrieve year, month, day directly as a 3-tuple:

year, month, day := gostradamus.NewUTCDateTime(2020, 1, 1, 12, 0, 0, 0).IsoCalendar()
println(year, month, day)
// 2020 1 1

Documentation

Index

Constants

View Source
const (
	// Iso8601 format
	//
	//     Example: 2012-12-12T12:12:12.000000
	//
	Iso8601 = "YYYY-MM-DDTHH:mm:ss.S"

	// Iso8601TZ format with timezone
	//
	//     Example with UTC: 2012-12-12T12:12:12.000000Z
	//     Example with timezone: 2012-12-12T12:12:12.000000+0200
	//
	Iso8601TZ = "YYYY-MM-DDTHH:mm:ss.SZ"

	// CTime format with ctime standard
	//
	//     Example: Sat Jan 19 18:26:50 2019
	//
	CTime = "ddd MMM DD HH:mm:ss YYYY"
)
View Source
const (
	YearFull  = FormatToken("YYYY")
	YearShort = FormatToken("YY")

	MonthFull       = FormatToken("MMMM")
	MonthAbbr       = FormatToken("MMM")
	MonthZeroPadded = FormatToken("MM")
	MonthShort      = FormatToken("M")

	DayOfYearZeroPadded  = FormatToken("DDDD")
	DayOfMonthZeroPadded = FormatToken("DD")
	DayOfMonthShort      = FormatToken("D")

	DayOfWeekFullName = FormatToken("dddd")
	DayOfWeekAbbr     = FormatToken("ddd")

	TwentyFourHourZeroPadded = FormatToken("HH")
	TwelveHourZeroPadded     = FormatToken("hh")
	TwelveHour               = FormatToken("h")

	AMPMUpper = FormatToken("A")
	AMPMLower = FormatToken("a")

	MinuteZeroPadded = FormatToken("mm")
	Minute           = FormatToken("m")

	SecondZeroPadded = FormatToken("ss")
	Second           = FormatToken("s")
	MicroSecond      = FormatToken("S")

	TimezoneFullName     = FormatToken("ZZZ")
	TimezoneWithColon    = FormatToken("zz")
	TimezoneWithoutColon = FormatToken("Z")

	GoLongMonth             = goFormatToken("January")
	GoMonth                 = goFormatToken("Jan")
	GoNumMonth              = goFormatToken("1")
	GoZeroMonth             = goFormatToken("01")
	GoLongWeekDay           = goFormatToken("Monday")
	GoWeekDay               = goFormatToken("Mon")
	GoDay                   = goFormatToken("2")
	GoZeroDay               = goFormatToken("02")
	GoZeroYearDay           = goFormatToken("002")
	GoHour                  = goFormatToken("15")
	GoHour12                = goFormatToken("3")
	GoZeroHour12            = goFormatToken("03")
	GoMinute                = goFormatToken("4")
	GoZeroMinute            = goFormatToken("04")
	GoSecond                = goFormatToken("5")
	GoZeroSecond            = goFormatToken("05")
	GoLongYear              = goFormatToken("2006")
	GoYear                  = goFormatToken("06")
	GoPM                    = goFormatToken("PM")
	Gopm                    = goFormatToken("pm")
	GoTZ                    = goFormatToken("MST")
	GoMillisecond           = goFormatToken("000")
	GoMicrosecond           = goFormatToken("000000")
	GoNanoSecond            = goFormatToken("000000000")
	GoISO8601TZ             = goFormatToken("Z0700") // prints Z for UTC
	GoISO8601SecondsTZ      = goFormatToken("Z070000")
	GoISO8601ShortTZ        = goFormatToken("Z07")
	GoISO8601ColonTZ        = goFormatToken("Z07:00") // prints Z for UTC
	GoISO8601ColonSecondsTZ = goFormatToken("Z07:00:00")
	GoNumTZ                 = goFormatToken("-0700") // always numeric
	GoNumSecondsTz          = goFormatToken("-070000")
	GoNumShortTZ            = goFormatToken("-07")    // always numeric
	GoNumColonTZ            = goFormatToken("-07:00") // always numeric
	GoNumColonSecondsTZ     = goFormatToken("-07:00:00")
)

All FormatTokens for parsing and formatting with DateTime

View Source
const (
	AfricaAbidjan                  = Timezone("Africa/Abidjan")
	AfricaAccra                    = Timezone("Africa/Accra")
	AfricaAddisAbaba               = Timezone("Africa/AddisAbaba")
	AfricaAlgiers                  = Timezone("Africa/Algiers")
	AfricaAsmara                   = Timezone("Africa/Asmara")
	AfricaBamako                   = Timezone("Africa/Bamako")
	AfricaBangui                   = Timezone("Africa/Bangui")
	AfricaBanjul                   = Timezone("Africa/Banjul")
	AfricaBissau                   = Timezone("Africa/Bissau")
	AfricaBlantyre                 = Timezone("Africa/Blantyre")
	AfricaBrazzaville              = Timezone("Africa/Brazzaville")
	AfricaBujumbura                = Timezone("Africa/Bujumbura")
	AfricaCairo                    = Timezone("Africa/Cairo")
	AfricaCasablanca               = Timezone("Africa/Casablanca")
	AfricaCeuta                    = Timezone("Africa/Ceuta")
	AfricaConakry                  = Timezone("Africa/Conakry")
	AfricaDakar                    = Timezone("Africa/Dakar")
	AfricaDaresSalaam              = Timezone("Africa/DaresSalaam")
	AfricaDjibouti                 = Timezone("Africa/Djibouti")
	AfricaDouala                   = Timezone("Africa/Douala")
	AfricaElAaiun                  = Timezone("Africa/ElAaiun")
	AfricaFreetown                 = Timezone("Africa/Freetown")
	AfricaGaborone                 = Timezone("Africa/Gaborone")
	AfricaHarare                   = Timezone("Africa/Harare")
	AfricaJohannesburg             = Timezone("Africa/Johannesburg")
	AfricaJuba                     = Timezone("Africa/Juba")
	AfricaKampala                  = Timezone("Africa/Kampala")
	AfricaKhartoum                 = Timezone("Africa/Khartoum")
	AfricaKigali                   = Timezone("Africa/Kigali")
	AfricaKinshasa                 = Timezone("Africa/Kinshasa")
	AfricaLagos                    = Timezone("Africa/Lagos")
	AfricaLibreville               = Timezone("Africa/Libreville")
	AfricaLome                     = Timezone("Africa/Lome")
	AfricaLuanda                   = Timezone("Africa/Luanda")
	AfricaLubumbashi               = Timezone("Africa/Lubumbashi")
	AfricaLusaka                   = Timezone("Africa/Lusaka")
	AfricaMalabo                   = Timezone("Africa/Malabo")
	AfricaMaputo                   = Timezone("Africa/Maputo")
	AfricaMaseru                   = Timezone("Africa/Maseru")
	AfricaMbabane                  = Timezone("Africa/Mbabane")
	AfricaMogadishu                = Timezone("Africa/Mogadishu")
	AfricaMonrovia                 = Timezone("Africa/Monrovia")
	AfricaNairobi                  = Timezone("Africa/Nairobi")
	AfricaNdjamena                 = Timezone("Africa/Ndjamena")
	AfricaNiamey                   = Timezone("Africa/Niamey")
	AfricaNouakchott               = Timezone("Africa/Nouakchott")
	AfricaOuagadougou              = Timezone("Africa/Ouagadougou")
	AfricaPortoNovo                = Timezone("Africa/Porto-Novo")
	AfricaSaoTome                  = Timezone("Africa/SaoTome")
	AfricaTripoli                  = Timezone("Africa/Tripoli")
	AfricaTunis                    = Timezone("Africa/Tunis")
	AfricaWindhoek                 = Timezone("Africa/Windhoek")
	AmericaAdak                    = Timezone("America/Adak")
	AmericaAnchorage               = Timezone("America/Anchorage")
	AmericaAnguilla                = Timezone("America/Anguilla")
	AmericaAntigua                 = Timezone("America/Antigua")
	AmericaAraguaina               = Timezone("America/Araguaina")
	AmericaArgentinaBuenosAires    = Timezone("America/Argentina/BuenosAires")
	AmericaArgentinaCatamarca      = Timezone("America/Argentina/Catamarca")
	AmericaArgentinaComodRivadavia = Timezone("America/Argentina/ComodRivadavia")
	AmericaArgentinaCordoba        = Timezone("America/Argentina/Cordoba")
	AmericaArgentinaJujuy          = Timezone("America/Argentina/Jujuy	Jujuy")
	AmericaArgentinaLaRioja        = Timezone("America/Argentina/LaRioja")
	AmericaArgentinaMendoza        = Timezone("America/Argentina/Mendoza")
	AmericaArgentinaRioGallegos    = Timezone("America/Argentina/RioGallegos")
	AmericaArgentinaSalta          = Timezone("America/Argentina/Salta	Salta")
	AmericaArgentinaSanJuan        = Timezone("America/Argentina/SanJuan")
	AmericaArgentinaSanLuis        = Timezone("America/Argentina/SanLuis")
	AmericaArgentinaTucuman        = Timezone("America/Argentina/Tucuman")
	AmericaArgentinaUshuaia        = Timezone("America/Argentina/Ushuaia")
	AmericaAruba                   = Timezone("America/Aruba")
	AmericaAsuncion                = Timezone("America/Asuncion")
	AmericaAtikokan                = Timezone("America/Atikokan")
	AmericaAtka                    = Timezone("America/Atka")
	AmericaBahia                   = Timezone("America/Bahia")
	AmericaBahiaBanderas           = Timezone("America/BahiaBanderas")
	AmericaBarbados                = Timezone("America/Barbados")
	AmericaBelem                   = Timezone("America/Belem")
	AmericaBelize                  = Timezone("America/Belize")
	AmericaBlanc                   = Timezone("America/Blanc")
	AmericaBoaVista                = Timezone("America/BoaVista")
	AmericaBogota                  = Timezone("America/Bogota")
	AmericaBoise                   = Timezone("America/Boise")
	AmericaBuenosAires             = Timezone("America/BuenosAires")
	AmericaCambridgeBay            = Timezone("America/CambridgeBay")
	AmericaCampoGrande             = Timezone("America/CampoGrande")
	AmericaCancun                  = Timezone("America/Cancun")
	AmericaCaracas                 = Timezone("America/Caracas")
	AmericaCatamarca               = Timezone("America/Catamarca")
	AmericaCayenne                 = Timezone("America/Cayenne")
	AmericaCayman                  = Timezone("America/Cayman")
	AmericaChicago                 = Timezone("America/Chicago")
	AmericaChihuahua               = Timezone("America/Chihuahua")
	AmericaCoralHarbour            = Timezone("America/CoralHarbour")
	AmericaCordoba                 = Timezone("America/Cordoba")
	AmericaCostaRica               = Timezone("America/CostaRica")
	AmericaCreston                 = Timezone("America/Creston")
	AmericaCuiaba                  = Timezone("America/Cuiaba")
	AmericaCuracao                 = Timezone("America/Curacao")
	AmericaDanmarkshavn            = Timezone("America/Danmarkshavn")
	AmericaDawson                  = Timezone("America/Dawson")
	AmericaDawsonCreek             = Timezone("America/DawsonCreek")
	AmericaDenver                  = Timezone("America/Denver")
	AmericaDetroit                 = Timezone("America/Detroit")
	AmericaDominica                = Timezone("America/Dominica")
	AmericaEdmonton                = Timezone("America/Edmonton")
	AmericaEirunepe                = Timezone("America/Eirunepe")
	AmericaElSalvador              = Timezone("America/ElSalvador")
	AmericaEnsenada                = Timezone("America/Ensenada")
	AmericaFortNelson              = Timezone("America/FortNelson")
	AmericaFortWayne               = Timezone("America/FortWayne")
	AmericaFortaleza               = Timezone("America/Fortaleza")
	AmericaGlaceBay                = Timezone("America/GlaceBay")
	AmericaGodthab                 = Timezone("America/Godthab")
	AmericaGooseBay                = Timezone("America/GooseBay")
	AmericaGrandTurk               = Timezone("America/GrandTurk")
	AmericaGrenada                 = Timezone("America/Grenada")
	AmericaGuadeloupe              = Timezone("America/Guadeloupe")
	AmericaGuatemala               = Timezone("America/Guatemala")
	AmericaGuayaquil               = Timezone("America/Guayaquil")
	AmericaGuyana                  = Timezone("America/Guyana")
	AmericaHalifax                 = Timezone("America/Halifax")
	AmericaHavana                  = Timezone("America/Havana")
	AmericaHermosillo              = Timezone("America/Hermosillo")
	AmericaIndianaIndianapolis     = Timezone("America/Indiana/Indianapolis")
	AmericaIndianaKnox             = Timezone("America/Indiana/Knox")
	AmericaIndianaMarengo          = Timezone("America/Indiana/Marengo")
	AmericaIndianaPetersburg       = Timezone("America/Indiana/Petersburg")
	AmericaIndianaTellCity         = Timezone("America/Indiana/TellCity")
	AmericaIndianaVevay            = Timezone("America/Indiana/Vevay")
	AmericaIndianaVincennes        = Timezone("America/Indiana/Vincennes")
	AmericaIndianaWinamac          = Timezone("America/Indiana/Winamac")
	AmericaIndianapolis            = Timezone("America/Indianapolis")
	AmericaInuvik                  = Timezone("America/Inuvik")
	AmericaIqaluit                 = Timezone("America/Iqaluit")
	AmericaJamaica                 = Timezone("America/Jamaica")
	AmericaJujuy                   = Timezone("America/Jujuy")
	AmericaJuneau                  = Timezone("America/Juneau")
	AmericaKentuckyLouisville      = Timezone("America/Kentucky/Louisville")
	AmericaKentuckyMonticello      = Timezone("America/Kentucky/Monticello")
	AmericaKnoxIN                  = Timezone("America/KnoxIN")
	AmericaKralendijk              = Timezone("America/Kralendijk")
	AmericaLaPaz                   = Timezone("America/LaPaz")
	AmericaLima                    = Timezone("America/Lima")
	AmericaLosAngeles              = Timezone("America/LosAngeles")
	AmericaLouisville              = Timezone("America/Louisville")
	AmericaLowerPrinces            = Timezone("America/LowerPrinces")
	AmericaMaceio                  = Timezone("America/Maceio")
	AmericaManagua                 = Timezone("America/Managua")
	AmericaManaus                  = Timezone("America/Manaus")
	AmericaMarigot                 = Timezone("America/Marigot")
	AmericaMartinique              = Timezone("America/Martinique")
	AmericaMatamoros               = Timezone("America/Matamoros")
	AmericaMazatlan                = Timezone("America/Mazatlan")
	AmericaMendoza                 = Timezone("America/Mendoza")
	AmericaMenominee               = Timezone("America/Menominee")
	AmericaMerida                  = Timezone("America/Merida")
	AmericaMetlakatla              = Timezone("America/Metlakatla")
	AmericaMexicoCity              = Timezone("America/MexicoCity")
	AmericaMiquelon                = Timezone("America/Miquelon")
	AmericaMoncton                 = Timezone("America/Moncton")
	AmericaMonterrey               = Timezone("America/Monterrey")
	AmericaMontevideo              = Timezone("America/Montevideo")
	AmericaMontreal                = Timezone("America/Montreal")
	AmericaMontserrat              = Timezone("America/Montserrat")
	AmericaNassau                  = Timezone("America/Nassau")
	AmericaNewYork                 = Timezone("America/NewYork")
	AmericaNipigon                 = Timezone("America/Nipigon")
	AmericaNome                    = Timezone("America/Nome")
	AmericaNoronha                 = Timezone("America/Noronha")
	AmericaNorthDakotaBeulah       = Timezone("America/NorthDakota/Beulah")
	AmericaNorthDakotaCenter       = Timezone("America/NorthDakota/Center")
	AmericaNorthDakotaNewSalem     = Timezone("America/NorthDakota/NewSalem")
	AmericaOjinaga                 = Timezone("America/Ojinaga")
	AmericaPanama                  = Timezone("America/Panama")
	AmericaPangnirtung             = Timezone("America/Pangnirtung")
	AmericaParamaribo              = Timezone("America/Paramaribo")
	AmericaPhoenix                 = Timezone("America/Phoenix")
	AmericaPortofSpain             = Timezone("America/PortofSpain")
	AmericaPort                    = Timezone("America/Port")
	AmericaPortoAcre               = Timezone("America/PortoAcre")
	AmericaPortoVelho              = Timezone("America/PortoVelho")
	AmericaPuertoRico              = Timezone("America/PuertoRico")
	AmericaPuntaArenas             = Timezone("America/PuntaArenas")
	AmericaRainyRiver              = Timezone("America/RainyRiver")
	AmericaRankinInlet             = Timezone("America/RankinInlet")
	AmericaRecife                  = Timezone("America/Recife")
	AmericaRegina                  = Timezone("America/Regina")
	AmericaResolute                = Timezone("America/Resolute")
	AmericaRioBranco               = Timezone("America/RioBranco")
	AmericaRosario                 = Timezone("America/Rosario")
	AmericaSantaIsabel             = Timezone("America/SantaIsabel")
	AmericaSantarem                = Timezone("America/Santarem")
	AmericaSantiago                = Timezone("America/Santiago")
	AmericaSantoDomingo            = Timezone("America/SantoDomingo")
	AmericaSaoPaulo                = Timezone("America/SaoPaulo")
	AmericaScoresbysund            = Timezone("America/Scoresbysund")
	AmericaShiprock                = Timezone("America/Shiprock")
	AmericaSitka                   = Timezone("America/Sitka")
	AmericaStBarthelemy            = Timezone("America/StBarthelemy")
	AmericaStJohns                 = Timezone("America/StJohns")
	AmericaStKitts                 = Timezone("America/StKitts")
	AmericaStLucia                 = Timezone("America/StLucia")
	AmericaStThomas                = Timezone("America/StThomas")
	AmericaStVincent               = Timezone("America/StVincent")
	AmericaSwiftCurrent            = Timezone("America/SwiftCurrent")
	AmericaTegucigalpa             = Timezone("America/Tegucigalpa")
	AmericaThule                   = Timezone("America/Thule")
	AmericaThunderBay              = Timezone("America/ThunderBay")
	AmericaTijuana                 = Timezone("America/Tijuana")
	AmericaToronto                 = Timezone("America/Toronto")
	AmericaTortola                 = Timezone("America/Tortola")
	AmericaVancouver               = Timezone("America/Vancouver")
	AmericaVirgin                  = Timezone("America/Virgin")
	AmericaWhitehorse              = Timezone("America/Whitehorse")
	AmericaWinnipeg                = Timezone("America/Winnipeg")
	AmericaYakutat                 = Timezone("America/Yakutat")
	AmericaYellowknife             = Timezone("America/Yellowknife")
	AntarcticaCasey                = Timezone("Antarctica/Casey")
	AntarcticaDavis                = Timezone("Antarctica/Davis")
	AntarcticaDumontDUrville       = Timezone("Antarctica/DumontDUrville")
	AntarcticaMacquarie            = Timezone("Antarctica/Macquarie")
	AntarcticaMawson               = Timezone("Antarctica/Mawson")
	AntarcticaMcMurdo              = Timezone("Antarctica/McMurdo")
	AntarcticaPalmer               = Timezone("Antarctica/Palmer")
	AntarcticaRothera              = Timezone("Antarctica/Rothera")
	AntarcticaSouthPole            = Timezone("Antarctica/SouthPole")
	AntarcticaSyowa                = Timezone("Antarctica/Syowa")
	AntarcticaTroll                = Timezone("Antarctica/Troll")
	AntarcticaVostok               = Timezone("Antarctica/Vostok")
	ArcticLongyearbyen             = Timezone("Arctic/Longyearbyen")
	AsiaAden                       = Timezone("Asia/Aden")
	AsiaAlmaty                     = Timezone("Asia/Almaty")
	AsiaAmman                      = Timezone("Asia/Amman")
	AsiaAnadyr                     = Timezone("Asia/Anadyr")
	AsiaAqtau                      = Timezone("Asia/Aqtau")
	AsiaAqtobe                     = Timezone("Asia/Aqtobe")
	AsiaAshgabat                   = Timezone("Asia/Ashgabat")
	AsiaAshkhabad                  = Timezone("Asia/Ashkhabad")
	AsiaAtyrau                     = Timezone("Asia/Atyrau")
	AsiaBaghdad                    = Timezone("Asia/Baghdad")
	AsiaBahrain                    = Timezone("Asia/Bahrain")
	AsiaBaku                       = Timezone("Asia/Baku")
	AsiaBangkok                    = Timezone("Asia/Bangkok")
	AsiaBarnaul                    = Timezone("Asia/Barnaul")
	AsiaBeirut                     = Timezone("Asia/Beirut")
	AsiaBishkek                    = Timezone("Asia/Bishkek")
	AsiaBrunei                     = Timezone("Asia/Brunei")
	AsiaCalcutta                   = Timezone("Asia/Calcutta")
	AsiaChita                      = Timezone("Asia/Chita")
	AsiaChoibalsan                 = Timezone("Asia/Choibalsan")
	AsiaChongqing                  = Timezone("Asia/Chongqing")
	AsiaChungking                  = Timezone("Asia/Chungking")
	AsiaColombo                    = Timezone("Asia/Colombo")
	AsiaDacca                      = Timezone("Asia/Dacca")
	AsiaDamascus                   = Timezone("Asia/Damascus")
	AsiaDhaka                      = Timezone("Asia/Dhaka")
	AsiaDili                       = Timezone("Asia/Dili")
	AsiaDubai                      = Timezone("Asia/Dubai")
	AsiaDushanbe                   = Timezone("Asia/Dushanbe")
	AsiaFamagusta                  = Timezone("Asia/Famagusta")
	AsiaGaza                       = Timezone("Asia/Gaza")
	AsiaHarbin                     = Timezone("Asia/Harbin")
	AsiaHebron                     = Timezone("Asia/Hebron")
	AsiaHoChiMinh                  = Timezone("Asia/HoChiMinh")
	AsiaHongKong                   = Timezone("Asia/HongKong")
	AsiaHovd                       = Timezone("Asia/Hovd")
	AsiaIrkutsk                    = Timezone("Asia/Irkutsk")
	AsiaIstanbul                   = Timezone("Asia/Istanbul")
	AsiaJakarta                    = Timezone("Asia/Jakarta")
	AsiaJayapura                   = Timezone("Asia/Jayapura")
	AsiaJerusalem                  = Timezone("Asia/Jerusalem")
	AsiaKabul                      = Timezone("Asia/Kabul")
	AsiaKamchatka                  = Timezone("Asia/Kamchatka")
	AsiaKarachi                    = Timezone("Asia/Karachi")
	AsiaKashgar                    = Timezone("Asia/Kashgar")
	AsiaKathmandu                  = Timezone("Asia/Kathmandu")
	AsiaKatmandu                   = Timezone("Asia/Katmandu")
	AsiaKhandyga                   = Timezone("Asia/Khandyga")
	AsiaKolkata                    = Timezone("Asia/Kolkata")
	AsiaKrasnoyarsk                = Timezone("Asia/Krasnoyarsk")
	AsiaKualaLumpur                = Timezone("Asia/KualaLumpur")
	AsiaKuching                    = Timezone("Asia/Kuching")
	AsiaKuwait                     = Timezone("Asia/Kuwait")
	AsiaMacao                      = Timezone("Asia/Macao")
	AsiaMacau                      = Timezone("Asia/Macau")
	AsiaMagadan                    = Timezone("Asia/Magadan")
	AsiaMakassar                   = Timezone("Asia/Makassar")
	AsiaManila                     = Timezone("Asia/Manila")
	AsiaMuscat                     = Timezone("Asia/Muscat")
	AsiaNovokuznetsk               = Timezone("Asia/Novokuznetsk")
	AsiaNovosibirsk                = Timezone("Asia/Novosibirsk")
	AsiaOmsk                       = Timezone("Asia/Omsk")
	AsiaOral                       = Timezone("Asia/Oral")
	AsiaPhnomPenh                  = Timezone("Asia/PhnomPenh")
	AsiaPontianak                  = Timezone("Asia/Pontianak")
	AsiaPyongyang                  = Timezone("Asia/Pyongyang")
	AsiaQatar                      = Timezone("Asia/Qatar")
	AsiaQyzylorda                  = Timezone("Asia/Qyzylorda")
	AsiaRangoon                    = Timezone("Asia/Rangoon")
	AsiaRiyadh                     = Timezone("Asia/Riyadh")
	AsiaSaigon                     = Timezone("Asia/Saigon")
	AsiaSakhalin                   = Timezone("Asia/Sakhalin")
	AsiaSamarkand                  = Timezone("Asia/Samarkand")
	AsiaSeoul                      = Timezone("Asia/Seoul")
	AsiaShanghai                   = Timezone("Asia/Shanghai")
	AsiaSingapore                  = Timezone("Asia/Singapore")
	AsiaSrednekolymsk              = Timezone("Asia/Srednekolymsk")
	AsiaTaipei                     = Timezone("Asia/Taipei")
	AsiaTashkent                   = Timezone("Asia/Tashkent")
	AsiaTbilisi                    = Timezone("Asia/Tbilisi")
	AsiaTehran                     = Timezone("Asia/Tehran")
	AsiaTelAviv                    = Timezone("Asia/TelAviv")
	AsiaThimbu                     = Timezone("Asia/Thimbu")
	AsiaThimphu                    = Timezone("Asia/Thimphu")
	AsiaTokyo                      = Timezone("Asia/Tokyo")
	AsiaTomsk                      = Timezone("Asia/Tomsk")
	AsiaUjungPandang               = Timezone("Asia/UjungPandang")
	AsiaUlaanbaatar                = Timezone("Asia/Ulaanbaatar")
	AsiaUlanBator                  = Timezone("Asia/UlanBator")
	AsiaUrumqi                     = Timezone("Asia/Urumqi")
	AsiaUst                        = Timezone("Asia/Ust")
	AsiaVientiane                  = Timezone("Asia/Vientiane")
	AsiaVladivostok                = Timezone("Asia/Vladivostok")
	AsiaYakutsk                    = Timezone("Asia/Yakutsk")
	AsiaYangon                     = Timezone("Asia/Yangon")
	AsiaYekaterinburg              = Timezone("Asia/Yekaterinburg")
	AsiaYerevan                    = Timezone("Asia/Yerevan")
	AtlanticAzores                 = Timezone("Atlantic/Azores")
	AtlanticBermuda                = Timezone("Atlantic/Bermuda")
	AtlanticCanary                 = Timezone("Atlantic/Canary")
	AtlanticCapeVerde              = Timezone("Atlantic/CapeVerde")
	AtlanticFaeroe                 = Timezone("Atlantic/Faeroe")
	AtlanticFaroe                  = Timezone("Atlantic/Faroe")
	AtlanticJanMayen               = Timezone("Atlantic/JanMayen")
	AtlanticMadeira                = Timezone("Atlantic/Madeira")
	AtlanticReykjavik              = Timezone("Atlantic/Reykjavik")
	AtlanticSouthGeorgia           = Timezone("Atlantic/SouthGeorgia")
	AtlanticStHelena               = Timezone("Atlantic/StHelena")
	AtlanticStanley                = Timezone("Atlantic/Stanley")
	AustraliaACT                   = Timezone("Australia/ACT")
	AustraliaAdelaide              = Timezone("Australia/Adelaide")
	AustraliaBrisbane              = Timezone("Australia/Brisbane")
	AustraliaBrokenHill            = Timezone("Australia/BrokenHill")
	AustraliaCanberra              = Timezone("Australia/Canberra")
	AustraliaCurrie                = Timezone("Australia/Currie")
	AustraliaDarwin                = Timezone("Australia/Darwin")
	AustraliaEucla                 = Timezone("Australia/Eucla")
	AustraliaHobart                = Timezone("Australia/Hobart")
	AustraliaLHI                   = Timezone("Australia/LHI")
	AustraliaLindeman              = Timezone("Australia/Lindeman")
	AustraliaLordHowe              = Timezone("Australia/LordHowe")
	AustraliaMelbourne             = Timezone("Australia/Melbourne")
	AustraliaNorth                 = Timezone("Australia/North")
	AustraliaNSW                   = Timezone("Australia/NSW")
	AustraliaPerth                 = Timezone("Australia/Perth")
	AustraliaQueensland            = Timezone("Australia/Queensland")
	AustraliaSouth                 = Timezone("Australia/South")
	AustraliaSydney                = Timezone("Australia/Sydney")
	AustraliaTasmania              = Timezone("Australia/Tasmania")
	AustraliaVictoria              = Timezone("Australia/Victoria")
	AustraliaWest                  = Timezone("Australia/West")
	AustraliaYancowinna            = Timezone("Australia/Yancowinna")
	BrazilAcre                     = Timezone("Brazil/Acre")
	BrazilDeNoronha                = Timezone("Brazil/DeNoronha")
	BrazilEast                     = Timezone("Brazil/East")
	BrazilWest                     = Timezone("Brazil/West")
	CanadaAtlantic                 = Timezone("Canada/Atlantic")
	CanadaCentral                  = Timezone("Canada/Central")
	CanadaEastern                  = Timezone("Canada/Eastern")
	CanadaMountain                 = Timezone("Canada/Mountain")
	CanadaNewfoundland             = Timezone("Canada/Newfoundland")
	CanadaPacific                  = Timezone("Canada/Pacific")
	CanadaSaskatchewan             = Timezone("Canada/Saskatchewan")
	CanadaYukon                    = Timezone("Canada/Yukon")
	CET                            = Timezone("CET")
	ChileContinental               = Timezone("Chile/Continental")
	ChileEasterIsland              = Timezone("Chile/EasterIsland")
	CST6CDT                        = Timezone("CST6CDT")
	Cuba                           = Timezone("Cuba")
	EET                            = Timezone("EET")
	Egypt                          = Timezone("Egypt")
	Eire                           = Timezone("Eire")
	EST                            = Timezone("EST")
	EST5EDT                        = Timezone("EST5EDT")
	EtcGMT                         = Timezone("Etc/GMT")
	EtcGMTPlus0                    = Timezone("Etc/GMT+0")
	EtcGMTPlus1                    = Timezone("Etc/GMT+1")
	EtcGMTPlus10                   = Timezone("Etc/GMT+10")
	EtcGMTPlus11                   = Timezone("Etc/GMT+11")
	EtcGMTPlus12                   = Timezone("Etc/GMT+12")
	EtcGMTPlus2                    = Timezone("Etc/GMT+2")
	EtcGMTPlus3                    = Timezone("Etc/GMT+3")
	EtcGMTPlus4                    = Timezone("Etc/GMT+4")
	EtcGMTPlus5                    = Timezone("Etc/GMT+5")
	EtcGMTPlus6                    = Timezone("Etc/GMT+6")
	EtcGMTPlus7                    = Timezone("Etc/GMT+7")
	EtcGMTPlus8                    = Timezone("Etc/GMT+8")
	EtcGMTPlus9                    = Timezone("Etc/GMT+9")
	EtcGMT0                        = Timezone("Etc/GMT0")
	EtcGMTMinus0                   = Timezone("Etc/GMT-0")
	EtcGMTMinus1                   = Timezone("Etc/GMT-1")
	EtcGMTMinus10                  = Timezone("Etc/GMT-10")
	EtcGMTMinus11                  = Timezone("Etc/GMT-11")
	EtcGMTMinus12                  = Timezone("Etc/GMT-12")
	EtcGMTMinus13                  = Timezone("Etc/GMT-13")
	EtcGMTMinus14                  = Timezone("Etc/GMT-14")
	EtcGMTMinus2                   = Timezone("Etc/GMT-2")
	EtcGMTMinus3                   = Timezone("Etc/GMT-3")
	EtcGMTMinus4                   = Timezone("Etc/GMT-4")
	EtcGMTMinus5                   = Timezone("Etc/GMT-5")
	EtcGMTMinus6                   = Timezone("Etc/GMT-6")
	EtcGMTMinus7                   = Timezone("Etc/GMT-7")
	EtcGMTMinus8                   = Timezone("Etc/GMT-8")
	EtcGMTMinus9                   = Timezone("Etc/GMT-9")
	EtcGreenwich                   = Timezone("Etc/Greenwich")
	EtcUCT                         = Timezone("Etc/UCT")
	EtcUniversal                   = Timezone("Etc/Universal")
	EtcUTC                         = Timezone("Etc/UTC")
	EtcZulu                        = Timezone("Etc/Zulu")
	EuropeAmsterdam                = Timezone("Europe/Amsterdam")
	EuropeAndorra                  = Timezone("Europe/Andorra")
	EuropeAstrakhan                = Timezone("Europe/Astrakhan")
	EuropeAthens                   = Timezone("Europe/Athens")
	EuropeBelfast                  = Timezone("Europe/Belfast")
	EuropeBelgrade                 = Timezone("Europe/Belgrade")
	EuropeBerlin                   = Timezone("Europe/Berlin")
	EuropeBratislava               = Timezone("Europe/Bratislava")
	EuropeBrussels                 = Timezone("Europe/Brussels")
	EuropeBucharest                = Timezone("Europe/Bucharest")
	EuropeBudapest                 = Timezone("Europe/Budapest")
	EuropeBusingen                 = Timezone("Europe/Busingen")
	EuropeChisinau                 = Timezone("Europe/Chisinau")
	EuropeCopenhagen               = Timezone("Europe/Copenhagen")
	EuropeDublin                   = Timezone("Europe/Dublin")
	EuropeGibraltar                = Timezone("Europe/Gibraltar")
	EuropeGuernsey                 = Timezone("Europe/Guernsey")
	EuropeHelsinki                 = Timezone("Europe/Helsinki")
	EuropeIsleofMan                = Timezone("Europe/IsleofMan")
	EuropeIstanbul                 = Timezone("Europe/Istanbul")
	EuropeJersey                   = Timezone("Europe/Jersey")
	EuropeKaliningrad              = Timezone("Europe/Kaliningrad")
	EuropeKiev                     = Timezone("Europe/Kiev")
	EuropeKirov                    = Timezone("Europe/Kirov")
	EuropeLisbon                   = Timezone("Europe/Lisbon")
	EuropeLjubljana                = Timezone("Europe/Ljubljana")
	EuropeLondon                   = Timezone("Europe/London")
	EuropeLuxembourg               = Timezone("Europe/Luxembourg")
	EuropeMadrid                   = Timezone("Europe/Madrid")
	EuropeMalta                    = Timezone("Europe/Malta")
	EuropeMariehamn                = Timezone("Europe/Mariehamn")
	EuropeMinsk                    = Timezone("Europe/Minsk")
	EuropeMonaco                   = Timezone("Europe/Monaco")
	EuropeMoscow                   = Timezone("Europe/Moscow")
	AsiaNicosia                    = Timezone("Asia/Nicosia")
	EuropeOslo                     = Timezone("Europe/Oslo")
	EuropeParis                    = Timezone("Europe/Paris")
	EuropePodgorica                = Timezone("Europe/Podgorica")
	EuropePrague                   = Timezone("Europe/Prague")
	EuropeRiga                     = Timezone("Europe/Riga")
	EuropeRome                     = Timezone("Europe/Rome")
	EuropeSamara                   = Timezone("Europe/Samara")
	EuropeSanMarino                = Timezone("Europe/SanMarino")
	EuropeSarajevo                 = Timezone("Europe/Sarajevo")
	EuropeSaratov                  = Timezone("Europe/Saratov")
	EuropeSimferopol               = Timezone("Europe/Simferopol")
	EuropeSkopje                   = Timezone("Europe/Skopje")
	EuropeSofia                    = Timezone("Europe/Sofia")
	EuropeStockholm                = Timezone("Europe/Stockholm")
	EuropeTallinn                  = Timezone("Europe/Tallinn")
	EuropeTirane                   = Timezone("Europe/Tirane")
	EuropeTiraspol                 = Timezone("Europe/Tiraspol")
	EuropeUlyanovsk                = Timezone("Europe/Ulyanovsk")
	EuropeUzhgorod                 = Timezone("Europe/Uzhgorod")
	EuropeVaduz                    = Timezone("Europe/Vaduz")
	EuropeVatican                  = Timezone("Europe/Vatican")
	EuropeVienna                   = Timezone("Europe/Vienna")
	EuropeVilnius                  = Timezone("Europe/Vilnius")
	EuropeVolgograd                = Timezone("Europe/Volgograd")
	EuropeWarsaw                   = Timezone("Europe/Warsaw")
	EuropeZagreb                   = Timezone("Europe/Zagreb")
	EuropeZaporozhye               = Timezone("Europe/Zaporozhye")
	EuropeZurich                   = Timezone("Europe/Zurich")
	GB                             = Timezone("GB")
	GBEire                         = Timezone("GB-Eire")
	GMT                            = Timezone("GMT")
	GMTPlus0                       = Timezone("GMT+0")
	GMT0                           = Timezone("GMT0")
	GMTMinus0                      = Timezone("GMT-0")
	Greenwich                      = Timezone("Greenwich")
	Hongkong                       = Timezone("Hongkong")
	HST                            = Timezone("HST")
	Iceland                        = Timezone("Iceland")
	IndianAntananarivo             = Timezone("Indian/Antananarivo")
	IndianChagos                   = Timezone("Indian/Chagos")
	IndianChristmas                = Timezone("Indian/Christmas")
	IndianCocos                    = Timezone("Indian/Cocos")
	IndianComoro                   = Timezone("Indian/Comoro")
	IndianKerguelen                = Timezone("Indian/Kerguelen")
	IndianMahe                     = Timezone("Indian/Mahe")
	IndianMaldives                 = Timezone("Indian/Maldives")
	IndianMauritius                = Timezone("Indian/Mauritius")
	IndianMayotte                  = Timezone("Indian/Mayotte")
	IndianReunion                  = Timezone("Indian/Reunion")
	Iran                           = Timezone("Iran")
	Israel                         = Timezone("Israel")
	Jamaica                        = Timezone("Jamaica")
	Japan                          = Timezone("Japan")
	Kwajalein                      = Timezone("Kwajalein")
	Libya                          = Timezone("Libya")
	MET                            = Timezone("MET")
	MexicoBajaNorte                = Timezone("Mexico/BajaNorte")
	MexicoBajaSur                  = Timezone("Mexico/BajaSur")
	MexicoGeneral                  = Timezone("Mexico/General")
	MST                            = Timezone("MST")
	MST7MDT                        = Timezone("MST7MDT")
	Navajo                         = Timezone("Navajo")
	NZ                             = Timezone("NZ")
	NZCHAT                         = Timezone("NZ-CHAT")
	PacificApia                    = Timezone("Pacific/Apia")
	PacificAuckland                = Timezone("Pacific/Auckland")
	PacificBougainville            = Timezone("Pacific/Bougainville")
	PacificChatham                 = Timezone("Pacific/Chatham")
	PacificChuuk                   = Timezone("Pacific/Chuuk")
	PacificEaster                  = Timezone("Pacific/Easter")
	PacificEfate                   = Timezone("Pacific/Efate")
	PacificEnderbury               = Timezone("Pacific/Enderbury")
	PacificFakaofo                 = Timezone("Pacific/Fakaofo")
	PacificFiji                    = Timezone("Pacific/Fiji")
	PacificFunafuti                = Timezone("Pacific/Funafuti")
	PacificGalapagos               = Timezone("Pacific/Galapagos")
	PacificGambier                 = Timezone("Pacific/Gambier")
	PacificGuadalcanal             = Timezone("Pacific/Guadalcanal")
	PacificGuam                    = Timezone("Pacific/Guam")
	PacificHonolulu                = Timezone("Pacific/Honolulu")
	PacificJohnston                = Timezone("Pacific/Johnston")
	PacificKiritimati              = Timezone("Pacific/Kiritimati")
	PacificKosrae                  = Timezone("Pacific/Kosrae")
	PacificKwajalein               = Timezone("Pacific/Kwajalein")
	PacificMajuro                  = Timezone("Pacific/Majuro")
	PacificMarquesas               = Timezone("Pacific/Marquesas")
	PacificMidway                  = Timezone("Pacific/Midway")
	PacificNauru                   = Timezone("Pacific/Nauru")
	PacificNiue                    = Timezone("Pacific/Niue")
	PacificNorfolk                 = Timezone("Pacific/Norfolk")
	PacificNoumea                  = Timezone("Pacific/Noumea")
	PacificPagoPago                = Timezone("Pacific/PagoPago")
	PacificPalau                   = Timezone("Pacific/Palau")
	PacificPitcairn                = Timezone("Pacific/Pitcairn")
	PacificPohnpei                 = Timezone("Pacific/Pohnpei")
	PacificPonape                  = Timezone("Pacific/Ponape")
	PacificPortMoresby             = Timezone("Pacific/PortMoresby")
	PacificRarotonga               = Timezone("Pacific/Rarotonga")
	PacificSaipan                  = Timezone("Pacific/Saipan")
	PacificSamoa                   = Timezone("Pacific/Samoa")
	PacificTahiti                  = Timezone("Pacific/Tahiti")
	PacificTarawa                  = Timezone("Pacific/Tarawa")
	PacificTongatapu               = Timezone("Pacific/Tongatapu")
	PacificTruk                    = Timezone("Pacific/Truk")
	PacificWake                    = Timezone("Pacific/Wake")
	PacificWallis                  = Timezone("Pacific/Wallis")
	PacificYap                     = Timezone("Pacific/Yap")
	Poland                         = Timezone("Poland")
	Portugal                       = Timezone("Portugal")
	PRC                            = Timezone("PRC")
	PST8PDT                        = Timezone("PST8PDT")
	ROC                            = Timezone("ROC")
	ROK                            = Timezone("ROK")
	Singapore                      = Timezone("Singapore")
	Turkey                         = Timezone("Turkey")
	UCT                            = Timezone("UCT")
	Universal                      = Timezone("Universal")
	USAlaska                       = Timezone("US/Alaska")
	USAleutian                     = Timezone("US/Aleutian")
	USArizona                      = Timezone("US/Arizona")
	USCentral                      = Timezone("US/Central")
	USEastern                      = Timezone("US/Eastern")
	USEastIndiana                  = Timezone("US/East-Indiana")
	USHawaii                       = Timezone("US/Hawaii")
	USIndianaStarke                = Timezone("US/Indiana-Starke")
	USMichigan                     = Timezone("US/Michigan")
	USMountain                     = Timezone("US/Mountain")
	USPacific                      = Timezone("US/Pacific")
	USPacificNew                   = Timezone("US/Pacific-New")
	USSamoa                        = Timezone("US/Samoa")
	UTC                            = Timezone("UTC")
	WET                            = Timezone("WET")
	WSU                            = Timezone("W-SU")
	Zulu                           = Timezone("Zulu")
)

All possible Timezones, which are supported by Go's "time" library

View Source
const WeekInDays = 7

WeekInDays is the integer value how many days a week has

Variables

This section is empty.

Functions

func FormatTokenIsNotMapped

func FormatTokenIsNotMapped(formatToken string) error

FormatTokenIsNotMapped errors the given formatToken

func LoadLocation

func LoadLocation(timezone string) (*time.Location, error)

LoadLocation returns the time.Locatior or an error of a timezone

Types

type DateTime

type DateTime time.Time

DateTime reflects time.Time and adds functionality of this library

func DateTimeFromTime

func DateTimeFromTime(time time.Time) DateTime

DateTimeFromTime returns a DateTime with given time.Time

func FromUnixTimestamp

func FromUnixTimestamp(timestamp int64) DateTime

FromUnixTimestamp gets the DateTime from given unix timestamp. The returned Datetime has the UTC timezone

func NewDateTime

func NewDateTime(
	year int,
	month int,
	day int,
	hour int,
	minute int,
	second int,
	nanosecond int,
	timezone Timezone,
) DateTime

NewDateTime returns a new DateTime in the timezone given

func NewLocalDateTime

func NewLocalDateTime(
	year int,
	month int,
	day int,
	hour int,
	minute int,
	second int,
	nanosecond int,
) DateTime

NewLocalDateTime creates a new DateTime in Local (system) timezone

func NewUTCDateTime

func NewUTCDateTime(
	year int,
	month int,
	day int,
	hour int,
	minute int,
	second int,
	nanosecond int,
) DateTime

NewUTCDateTime returns a new DateTime with timezone in UTC

func Now

func Now() DateTime

Now returns the current local DateTime

func NowInTimezone

func NowInTimezone(timezone Timezone) DateTime

NowInTimezone returns the current DateTime in given timezone

func Parse

func Parse(value string, format string) (DateTime, error)

Parse a string value with given format into a new DateTime

func ParseInTimezone

func ParseInTimezone(value string, format string, timezone Timezone) (DateTime, error)

ParseInTimezone a string value with given format into a new DateTime in given timezone

func UTCNow

func UTCNow() DateTime

UTCNow returns the current DateTime in UTC timezone

func (DateTime) CTimeFormat

func (dt DateTime) CTimeFormat() string

CTimeFormat the current DateTime to ctime standard

Example: Sat Feb 15 12:12:12 2020

func (DateTime) CeilDay

func (dt DateTime) CeilDay() DateTime

CeilDay returns a DateTime with all values to "ceil" except year, month, day, minute, second

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-12 23:59:59.999999999

func (DateTime) CeilHour

func (dt DateTime) CeilHour() DateTime

CeilHour returns a DateTime with all values to "ceil" except year, month, day, hour

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-12 12:59:59.999999999

func (DateTime) CeilMinute

func (dt DateTime) CeilMinute() DateTime

CeilMinute returns a DateTime with all values to "ceil" except year, month, day, hour, minute

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-12 12:12:59.999999999

func (DateTime) CeilMonth

func (dt DateTime) CeilMonth() DateTime

CeilMonth returns a DateTime with all values to "ceil" except year, month

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-31 23:59:59.999999999

func (DateTime) CeilSecond

func (dt DateTime) CeilSecond() DateTime

CeilSecond returns a DateTime with all values to "ceil" except year, month, day, hour, minute, second

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-12 12:12:12.999999999

func (DateTime) CeilWeek added in v1.0.3

func (dt DateTime) CeilWeek() DateTime

CeilWeek returns a DateTime with all values to "ceil" of current DateTime's week except year, month

For Example:

2012-12-12 12:12:12.123456789 (wednesday) becomes 2012-12-16 23:59:59:123456789 (sunday)

func (DateTime) CeilYear

func (dt DateTime) CeilYear() DateTime

CeilYear returns a DateTime with all values to "ceil" except year

For Example:

2012-05-12 12:12:12.123456789 becomes 2012-12-31 23:59:59.999999999

func (DateTime) Copy

func (dt DateTime) Copy() DateTime

Copy the current DateTime to a new DateTime

func (DateTime) Day

func (dt DateTime) Day() int

Day of current DateTime as int

func (DateTime) FloorDay

func (dt DateTime) FloorDay() DateTime

FloorDay returns a DateTime with all values to "floor" except year, month, day

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-12 00:00:00.00000000

func (DateTime) FloorHour

func (dt DateTime) FloorHour() DateTime

FloorHour returns a DateTime with all values to "floor" except year, month, day, hour

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-12 12:00:00.00000000

func (DateTime) FloorMinute

func (dt DateTime) FloorMinute() DateTime

FloorMinute returns a DateTime with all values to "floor" except year, month, day, hour, minute

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-12 12:12:00.00000000

func (DateTime) FloorMonth

func (dt DateTime) FloorMonth() DateTime

FloorMonth returns a DateTime with all values to "floor" except year, month

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-01 00:00:00.00000000

func (DateTime) FloorSecond

func (dt DateTime) FloorSecond() DateTime

FloorSecond returns a DateTime with all values to "floor" except year, month, day, hour, minute, second

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-12-31 12:12:12.00000000

func (DateTime) FloorWeek added in v1.0.3

func (dt DateTime) FloorWeek() DateTime

FloorWeek returns a DateTime with all values to "floor" of current DateTime's week except year, month

For Example:

2012-12-12 12:12:12.123456789 (wednesday) becomes 2012-12-10 00:00:00.000000000 (monday)

func (DateTime) FloorYear

func (dt DateTime) FloorYear() DateTime

FloorYear returns a DateTime with all values to "floor" except year

For Example:

2012-12-12 12:12:12.123456789 becomes 2012-01-01 00:00:00.00000000

func (DateTime) Format

func (dt DateTime) Format(format string) string

Format the current DateTime with given format to a string

func (DateTime) GoString

func (dt DateTime) GoString() string

GoString of the DateTime it will use the IsoFormat The GoString method is used to print values passed as an operand to a %#v format.

func (DateTime) Hour

func (dt DateTime) Hour() int

Hour of current DateTime as int

func (DateTime) InTimezone

func (dt DateTime) InTimezone(timezone Timezone) DateTime

InTimezone sets the current DateTime in the given Timezone and returns a new DateTime

func (DateTime) IsBetween

func (dt DateTime) IsBetween(start DateTime, end DateTime) bool

IsBetween checks if current DateTime is between start and end DateTimes

func (DateTime) IsoCalendar

func (dt DateTime) IsoCalendar() (int, int, int)

IsoCalendar returns three int values with (year, month, day)

func (DateTime) IsoFormat

func (dt DateTime) IsoFormat() string

IsoFormat the current DateTime into ISO-8601 standard

For Example:

2017-07-14T02:40:00.000000

func (DateTime) IsoFormatTZ

func (dt DateTime) IsoFormatTZ() string

IsoFormatTZ the current DateTime into ISO-8601 standard and current timezone info

For Example:

2017-07-14T02:40:00.000000+0200

func (DateTime) Minute

func (dt DateTime) Minute() int

Minute of current DateTime as int

func (DateTime) Month

func (dt DateTime) Month() int

Month of current DateTime as int

func (DateTime) Nanosecond

func (dt DateTime) Nanosecond() int

Nanosecond of current DateTime as int

func (DateTime) Replace

func (dt DateTime) Replace(year int, month int, day int, hour int, minute int, second int, nanosecond int) DateTime

Replace will set the year, month, day, hour, minute, second, and nanosecond of current DateTime and returns a new DateTime

func (DateTime) ReplaceDay

func (dt DateTime) ReplaceDay(day int) DateTime

ReplaceDay will set the day of current DateTime and returns a new DateTime

func (DateTime) ReplaceHour

func (dt DateTime) ReplaceHour(hour int) DateTime

ReplaceHour will set the hour of current DateTime and returns a new DateTime

func (DateTime) ReplaceMinute

func (dt DateTime) ReplaceMinute(minute int) DateTime

ReplaceMinute will set the minute of current DateTime and returns a new DateTime

func (DateTime) ReplaceMonth

func (dt DateTime) ReplaceMonth(month int) DateTime

ReplaceMonth will set the month of current DateTime and returns a new DateTime

func (DateTime) ReplaceNanosecond

func (dt DateTime) ReplaceNanosecond(nanosecond int) DateTime

ReplaceNanosecond will set the nanosecond of current DateTime and returns a new DateTime

func (DateTime) ReplaceSecond

func (dt DateTime) ReplaceSecond(second int) DateTime

ReplaceSecond will set the second of current DateTime and returns a new DateTime

func (DateTime) ReplaceYear

func (dt DateTime) ReplaceYear(year int) DateTime

ReplaceYear will set the year of current DateTime and returns a new DateTime

func (DateTime) Second

func (dt DateTime) Second() int

Second of current DateTime as int

func (DateTime) Shift

func (dt DateTime) Shift(years int, months int, days int, hours int, minutes int, seconds int, nanoseconds int) DateTime

Shift adds or subtracts years, months, days, hours, minutes, seconds, and nanoseconds of current DateTime and returns a new DateTime Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftDays

func (dt DateTime) ShiftDays(days int) DateTime

ShiftDays adds or subtracts days Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftHours

func (dt DateTime) ShiftHours(hours int) DateTime

ShiftHours adds or subtracts hours Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftMicroSeconds

func (dt DateTime) ShiftMicroSeconds(microsecond int) DateTime

ShiftMicroSeconds adds or subtracts microseconds Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftMilliSeconds

func (dt DateTime) ShiftMilliSeconds(millisecond int) DateTime

ShiftMilliSeconds adds or subtracts milliseconds Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftMinutes

func (dt DateTime) ShiftMinutes(minutes int) DateTime

ShiftMinutes adds or subtracts minutes Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftMonths

func (dt DateTime) ShiftMonths(months int) DateTime

ShiftMonths adds or subtracts months Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftNanoseconds

func (dt DateTime) ShiftNanoseconds(nanosecond int) DateTime

ShiftNanoseconds adds or subtracts nanoseconds in current DateTime and returns a new DateTime Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftSeconds

func (dt DateTime) ShiftSeconds(second int) DateTime

ShiftSeconds adds or subtracts seconds Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftWeeks added in v1.0.3

func (dt DateTime) ShiftWeeks(weeks int) DateTime

ShiftWeeks add or subtracts weeks Add is a positive integer Subtract is a negative integer

func (DateTime) ShiftYears

func (dt DateTime) ShiftYears(years int) DateTime

ShiftYears adds or subtracts years in current DateTime and returns a new DateTime Add is a positive integer Subtract is a negative integer

func (DateTime) SpanDay

func (dt DateTime) SpanDay() (DateTime, DateTime)

SpanDay returns the start and end DateTime of current day span

For Example:

2012-12-12 12:12:12:123456789 becomes (2012-12-12 00:00:00.000000000, 2012-12-12 23:59:59.999999999)

func (DateTime) SpanHour

func (dt DateTime) SpanHour() (DateTime, DateTime)

SpanHour returns the start and end DateTime of current hour span

For Example:

2012-12-12 12:12:12:123456789 becomes (2012-12-12 12:00:00.000000000, 2012-12-12 12:59:59.999999999)

func (DateTime) SpanMinute

func (dt DateTime) SpanMinute() (DateTime, DateTime)

SpanMinute returns the start and end DateTime of current minute span

For Example:

2012-12-12 12:12:12:123456789 becomes (2012-12-12 12:12:00.000000000, 2012-12-12 12:12:59.999999999)

func (DateTime) SpanMonth

func (dt DateTime) SpanMonth() (DateTime, DateTime)

SpanMonth returns the start and end DateTime of current month span

For Example:

2012-12-12 12:12:12:123456789 becomes (2012-12-01 00:00:00.000000000, 2012-12-31 23:59:59.999999999)

func (DateTime) SpanSecond

func (dt DateTime) SpanSecond() (DateTime, DateTime)

SpanSecond returns the start and end DateTime of current second span

For Example:

2012-12-12 12:12:12:123456789 becomes (2012-12-12 12:12:12.000000000, 2012-12-12 12:12:12.999999999)

func (DateTime) SpanWeek added in v1.0.3

func (dt DateTime) SpanWeek() (DateTime, DateTime)

SpanWeek returns the start and end DateTime of current week span

For Example:

2012-12-12 12:12:12.123456789 becomes (2012-12-10 00:00:00.00000000, 2012-12-16 23:59:59.999999999)

func (DateTime) SpanYear

func (dt DateTime) SpanYear() (DateTime, DateTime)

SpanYear returns the start and end DateTime of current year span

For Example:

2012-05-12 12:12:12:123456789 becomes (2012-01-01 00:00:00.000000000, 2012-12-31 23:59:59.999999999)

func (DateTime) String

func (dt DateTime) String() string

String of the DateTime it will use the IsoFormat It defines the “native” format for that value. The String method is used to print values passed as an operand to any format that accepts a string or to an unformatted printer such as Print.

func (DateTime) Time

func (dt DateTime) Time() time.Time

Time returns the underlying time.Time of DateTime

func (DateTime) Timezone

func (dt DateTime) Timezone() Timezone

Timezone returns the Timezone of current DateTime object

func (DateTime) UnixTimestamp

func (dt DateTime) UnixTimestamp() int64

UnixTimestamp returns the unix timestamp as int64

func (DateTime) WeekDay

func (dt DateTime) WeekDay() time.Weekday

WeekDay returns time.Weekday

func (DateTime) Year

func (dt DateTime) Year() int

Year of current DateTime as int

type FormatToken

type FormatToken string

FormatToken helps to hold all possible tokens for parsing and formatting

type Timezone

type Timezone string

Timezone is a string type which can translate from and to time.Location

func Local

func Local() Timezone

Local is a wrapper for "Local" as a Timezone

func (Timezone) Location

func (t Timezone) Location() *time.Location

Location returns the Location of current Timezone

Location panics if current Timzeone does not exist

func (Timezone) String

func (t Timezone) String() string

String returns Timezone as string Example: "Europe/Berlin"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL