Documentation ¶
Overview ¶
Package datetime contains date & time protobuf serialization, comparison and other common operations.
Index ¶
- func DateIsAfter(a, b *pbdatetime.Date) bool
- func DateIsBefore(a, b *pbdatetime.Date) bool
- func DateIsEqual(a, b *pbdatetime.Date) bool
- func DiffDays(a, b time.Time) int64
- func EuropeMadrid() *time.Location
- func Format(t time.Time, locale, layout string) string
- func ParseDate(date *pbdatetime.Date) time.Time
- func ParseTimestamp(timestamp *pbtimestamp.Timestamp) time.Time
- func SerializeDate(t time.Time) *pbdatetime.Date
- func SerializeTimestamp(t time.Time) *pbtimestamp.Timestamp
- func TimeToDate(t time.Time) time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DateIsAfter ¶ added in v1.55.0
func DateIsAfter(a, b *pbdatetime.Date) bool
DateIsAfter returns if date "a" is after date "b".
func DateIsBefore ¶ added in v1.55.0
func DateIsBefore(a, b *pbdatetime.Date) bool
DateIsAfter returns if date "a" is before date "b".
func DateIsEqual ¶ added in v1.55.0
func DateIsEqual(a, b *pbdatetime.Date) bool
DateIsEqual returns if date "a" is equal to date "b".
func EuropeMadrid ¶ added in v1.32.0
func Format ¶
Format returns a textual representation of the time value formatted according to layout, which defines the format by showing how the reference time, defined to be
Mon Jan 2 15:04:05 2006
would be displayed if it were the value; it serves as an example of the desired output. The same display rules will then be applied to the time value.
Predefined layouts ANSIC, UnixDate, RFC3339 and others describe standard and convenient representations of the reference time. For more information about the formats and the definition of the reference time, see the documentation for ANSIC and the other constants defined by this package.
func ParseDate ¶
func ParseDate(date *pbdatetime.Date) time.Time
ParseDate converts a proto to Go time.Time.
func ParseTimestamp ¶
func ParseTimestamp(timestamp *pbtimestamp.Timestamp) time.Time
ParseTimestamp converts a proto to Go time.Time.
func SerializeDate ¶
func SerializeDate(t time.Time) *pbdatetime.Date
SerializeDate converts a Go time.Time to proto considering only the date part.
func SerializeTimestamp ¶
func SerializeTimestamp(t time.Time) *pbtimestamp.Timestamp
SerializeTimestamp converts a Go time.Time to proto.
Types ¶
This section is empty.