timeconv

package
v2.14.3+incompatible Latest Latest
Warning

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

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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