mirror of
https://github.com/golang/go
synced 2024-11-26 18:16:48 -07:00
time: make it clearer how to format a fractional second
Fixes #10963. Change-Id: I8d769b4d25b306f2df41f882ec01d97bbd63171d Reviewed-on: https://go-review.googlesource.com/12221 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
parent
d000e8742a
commit
47f22ab775
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user