strftime

package module
v0.0.0-...-1d33003 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: MIT Imports: 2 Imported by: 127 modules, 131 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-strftime

go implementation of strftime

Example

package main

import (
	"fmt"
	"time"

	strftime "github.com/jehiah/go-strftime"
)

func main() {
	t := time.Unix(1340244776, 0)
	utc, _ := time.LoadLocation("UTC")
	t = t.In(utc)
	fmt.Println(strftime.Format("%Y-%m-%d %H:%M:%S", t))
	// Output:
	// 2012-06-21 02:12:56
}

Documentation

Overview

go implementation of strftime

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(format string, t time.Time) string

This is an alternative to time.Format because no one knows what date 040305 is supposed to create when used as a 'layout' string this takes standard strftime format options. For a complete list of format options see http://strftime.org/

Example
t := time.Unix(1340244776, 0)
utc, _ := time.LoadLocation("UTC")
t = t.In(utc)
fmt.Println(Format("%Y-%m-%d %H:%M:%S", t))
Output:
2012-06-21 02:12:56

Types

This section is empty.

Jump to

Keyboard shortcuts

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