datetime

package
v1.52.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: MIT Imports: 8 Imported by: 0

README

datetime

GoDoc

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

Install
import (
	"libs.altipla.consulting/datetime"
)
Contributing

You can make pull requests or create issues in GitHub. Any code you send should be formatted using make gofmt.

Running tests

Run the tests:

make test
License

MIT License

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 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 the remaining time to reach the date.

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