datetime

package
v1.110.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package datetime contains date & time protobuf serialization, comparison and other common operations.

Index

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 DiffDays

func DiffDays(a, b time.Time) int64

DiffDays returns the difference between the two dates in days.

func EuropeMadrid added in v1.32.0

func EuropeMadrid() *time.Location

func Format

func Format(t time.Time, locale, layout string) string

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.

func TimeToDate

func TimeToDate(t time.Time) time.Time

TimeToDate returns only the date part of the time removing any hour, minutes or seconds.

Types

This section is empty.

Directories

Path Synopsis
Package symbols contains the autogenerated i18n symbols for formatting.
Package symbols contains the autogenerated i18n symbols for formatting.

Jump to

Keyboard shortcuts

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