std/timego
On this page
Index
- const
ANSIC - const
UNIX_DATE - const
RUBY_DATE - const
RFC822 - const
RFC822Z - const
RFC850 - const
RFC1123 - const
RFC1123Z - const
RFC3339 - const
RFC3339_NANO - const
KITCHEN - const
STAMP - const
STAMP_MILLI - const
STAMP_MICRO - const
STAMP_NANO - const
DATE_TIME - const
DATE_ONLY - const
TIME_ONLY - type
Layout- method
Layout.format - method
Layout.parse
- method
- fn
layout - fn
format - fn
parse
Constants
ANSIC
const ANSIC: Str = "Mon Jan _2 15:04:05 2006"Go’s layout constants (time/format.go).
UNIX_DATE
const UNIX_DATE: Str = "Mon Jan _2 15:04:05 MST 2006"RUBY_DATE
const RUBY_DATE: Str = "Mon Jan 02 15:04:05 -0700 2006"RFC822
const RFC822: Str = "02 Jan 06 15:04 MST"RFC822Z
const RFC822Z: Str = "02 Jan 06 15:04 -0700"RFC850
const RFC850: Str = "Monday, 02-Jan-06 15:04:05 MST"RFC1123
const RFC1123: Str = "Mon, 02 Jan 2006 15:04:05 MST"RFC1123Z
const RFC1123Z: Str = "Mon, 02 Jan 2006 15:04:05 -0700"RFC3339
const RFC3339: Str = "2006-01-02T15:04:05Z07:00"RFC3339_NANO
const RFC3339_NANO: Str = "2006-01-02T15:04:05.999999999Z07:00"KITCHEN
const KITCHEN: Str = "3:04PM"STAMP
const STAMP: Str = "Jan _2 15:04:05"STAMP_MILLI
const STAMP_MILLI: Str = "Jan _2 15:04:05.000"STAMP_MICRO
const STAMP_MICRO: Str = "Jan _2 15:04:05.000000"STAMP_NANO
const STAMP_NANO: Str = "Jan _2 15:04:05.000000000"DATE_TIME
const DATE_TIME: Str = "2006-01-02 15:04:05"DATE_ONLY
const DATE_ONLY: Str = "2006-01-02"TIME_ONLY
const TIME_ONLY: Str = "15:04:05"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.
Layout.format
fn (l: Layout) format(t: Time, z: time.Zone) -> StrGo’s Time.Format for the layout.
Layout.parse
fn (l: Layout) parse(s: Str, z: time.Zone) -> Time ! time.ParseErrGo’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.
Functions
layout
fn layout(go_layout: Str) -> LayoutScans a Go layout (every string is a layout: text that is not a reference element is literal).
format
fn format(t: Time, z: time.Zone, go_layout: Str) -> Strlayout(go_layout).format(t, z).
parse
fn parse(s: Str, go_layout: Str, z: time.Zone) -> Time ! time.ParseErrlayout(go_layout).parse(s, z).