Commit 47f22ab7 authored by Rob Pike's avatar Rob Pike

time: make it clearer how to format a fractional second

Fixes #10963.

Change-Id: I8d769b4d25b306f2df41f882ec01d97bbd63171d
Reviewed-on: https://go-review.googlesource.com/12221Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
parent d000e874
......@@ -39,6 +39,9 @@ import "errors"
// offset for the UTC zone. Thus:
// Z0700 Z or ±hhmm
// Z07:00 Z or ±hh:mm
//
// The executable example for time.Format demonstrates the working
// of the layout string in detail and is a good reference.
const (
ANSIC = "Mon Jan _2 15:04:05 2006"
UnixDate = "Mon Jan _2 15:04:05 MST 2006"
......@@ -405,6 +408,11 @@ func (t Time) String() string {
// 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.
//
// A fractional second is represented by adding a period and zeros
// to the end of the seconds section of layout string, as in "15:04:05.000"
// to format a time stamp with millisecond precision.
//
// 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
......@@ -671,7 +679,7 @@ func skip(value, prefix string) (string, error) {
// 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.
// Also, the executable Example for time.Format demonstrates the working
// Also, the executable example for time.Format demonstrates the working
// of the layout string in detail and is a good reference.
//
// Elements omitted from the value are assumed to be zero or, when
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment