datetime

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: BSD-3-Clause Imports: 3 Imported by: 27 modules, 65 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DateTime

type DateTime time.Time

DateTime is an alias for time.Time which implements serialization matching the Conjure wire specification at https://github.com/palantir/conjure/blob/master/docs/spec/wire.md

Note that the wire specification states only "In accordance with ISO 8601." The Go implementation will marshal all output for this type using the time.RFC3339Nano format. The Go implementation will unmarshal all representations that adhere to the time.RFC3339Nano format and also supports unmarshalling any of the following ISO-8601 formats:

  • uuuu-MM-dd'T'HH:mmXXXXX
  • uuuu-MM-dd'T'HH:mm:ssXXXXX
  • uuuu-MM-dd'T'HH:mm:ss.SSSXXXXX
  • uuuu-MM-dd'T'HH:mm:ss.SSSSSSXXXXX
  • uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSXXXXX

The above formats are specifically supported because they are the formats produced by Java's OffsetDateTime type's ToString method (https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html#toString--).

func ParseDateTime

func ParseDateTime(s string) (DateTime, error)

ParseDateTime parses a DateTime from a string. Supports all strings that match the time.RFC3339Nano format as well as ISO 8601 formats produced by Java's OffsetDateTime type. If the provided string contains an open bracket ('['), only parses the input before the first occurrence of the open bracket (this is to support inputs that end with an optional zone identifier enclosed in square brackets: for example, "2017-01-02T04:04:05.000000000+01:00[Europe/Berlin]").

func (DateTime) AppendText added in v1.5.0

func (d DateTime) AppendText(b []byte) ([]byte, error)

AppendText implements encoding.TextAppender.

func (DateTime) MarshalText

func (d DateTime) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler (used by encoding/json and others).

func (DateTime) String

func (d DateTime) String() string

func (*DateTime) UnmarshalText

func (d *DateTime) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextUnmarshaler (used by encoding/json and others).

Jump to

Keyboard shortcuts

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