Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · timego

Docs

std/timego

On this page

Index

Constants

ANSIC

const ANSIC: Str = "Mon Jan _2 15:04:05 2006"

Go’s layout constants (time/format.go).

Source: std/timego.xo:7

UNIX_DATE

const UNIX_DATE: Str = "Mon Jan _2 15:04:05 MST 2006"

Source: std/timego.xo:8

RUBY_DATE

const RUBY_DATE: Str = "Mon Jan 02 15:04:05 -0700 2006"

Source: std/timego.xo:9

RFC822

const RFC822: Str = "02 Jan 06 15:04 MST"

Source: std/timego.xo:10

RFC822Z

const RFC822Z: Str = "02 Jan 06 15:04 -0700"

Source: std/timego.xo:11

RFC850

const RFC850: Str = "Monday, 02-Jan-06 15:04:05 MST"

Source: std/timego.xo:12

RFC1123

const RFC1123: Str = "Mon, 02 Jan 2006 15:04:05 MST"

Source: std/timego.xo:13

RFC1123Z

const RFC1123Z: Str = "Mon, 02 Jan 2006 15:04:05 -0700"

Source: std/timego.xo:14

RFC3339

const RFC3339: Str = "2006-01-02T15:04:05Z07:00"

Source: std/timego.xo:15

RFC3339_NANO

const RFC3339_NANO: Str = "2006-01-02T15:04:05.999999999Z07:00"

Source: std/timego.xo:16

KITCHEN

const KITCHEN: Str = "3:04PM"

Source: std/timego.xo:17

STAMP

const STAMP: Str = "Jan _2 15:04:05"

Source: std/timego.xo:18

STAMP_MILLI

const STAMP_MILLI: Str = "Jan _2 15:04:05.000"

Source: std/timego.xo:19

STAMP_MICRO

const STAMP_MICRO: Str = "Jan _2 15:04:05.000000"

Source: std/timego.xo:20

STAMP_NANO

const STAMP_NANO: Str = "Jan _2 15:04:05.000000000"

Source: std/timego.xo:21

DATE_TIME

const DATE_TIME: Str = "2006-01-02 15:04:05"

Source: std/timego.xo:22

DATE_ONLY

const DATE_ONLY: Str = "2006-01-02"

Source: std/timego.xo:23

TIME_ONLY

const TIME_ONLY: Str = "15:04:05"

Source: std/timego.xo:24

Types

Layout

struct Layout {
  text: Str
  kinds: List[Int]
  lits: List[Str]
  ns: List[Int]
}

A Go layout scanned once: its literal text and reference elements. Hot code makes one and calls format and parse on it.

Source: std/timego.xo:28

Layout.format

fn (l: Layout) format(t: Time, z: time.Zone) -> Str

Go’s Time.Format for the layout.

Source: std/timego.xo:38

Layout.parse

fn (l: Layout) parse(s: Str, z: time.Zone) -> Time ! time.ParseErr

Go’s time.ParseInLocation for the layout: z is the zone of a text without an offset. A time outside what a Time holds (1677 to 2262) is a ParseErr; a civil time in a daylight saving gap or overlap is the earlier one.

Source: std/timego.xo:41

Functions

layout

fn layout(go_layout: Str) -> Layout

Scans a Go layout (every string is a layout: text that is not a reference element is literal).

Source: std/timego.xo:36

format

fn format(t: Time, z: time.Zone, go_layout: Str) -> Str

layout(go_layout).format(t, z).

Source: std/timego.xo:44

parse

fn parse(s: Str, go_layout: Str, z: time.Zone) -> Time ! time.ParseErr

layout(go_layout).parse(s, z).

Source: std/timego.xo:46

↑ index