Version: v2.14.3+incompatible Latest Latest

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

Go to latest
Published: Jul 30, 2019 License: Apache-2.0 Imports: 2 Imported by: 0



Package timeconv contains utilities for converting time.

The gRPC/Protobuf libraries contain time implementations that require conversion to and from Go times. This library provides utilities and convenience functions for performing conversions.



This section is empty.


This section is empty.


func Format

func Format(ts *timestamp.Timestamp, layout string) string

Format formats a *timestamp.Timestamp into a string.

This follows the rules for time.Time.Format().

func Now

func Now() *timestamp.Timestamp

Now creates a timestamp.Timestamp representing the current time.

func String

func String(ts *timestamp.Timestamp) string

String formats the timestamp into a user-friendly string.

Currently, this uses the 'time.ANSIC' format string, but there is no guarantee that this will not change.

This is a convenience function for formatting timestamps for user display.

func Time

func Time(ts *timestamp.Timestamp) time.Time

Time converts a protobuf *timestamp.Timestamp to a time.Time.

func Timestamp

func Timestamp(t time.Time) *timestamp.Timestamp

Timestamp converts a time.Time to a protobuf *timestamp.Timestamp.


This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL