Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
a7e473be
Commit
a7e473be
authored
Oct 31, 2011
by
Scott Lawrence
Committed by
Rob Pike
Oct 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time: add RFC1123 with numeric timezone format
Fixes #841. R=rsc, r CC=golang-dev
https://golang.org/cl/5322058
parent
739c442e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
format.go
src/pkg/time/format.go
+6
-6
time_test.go
src/pkg/time/time_test.go
+3
-0
No files found.
src/pkg/time/format.go
View file @
a7e473be
...
...
@@ -45,12 +45,12 @@ const (
UnixDate
=
"Mon Jan _2 15:04:05 MST 2006"
RubyDate
=
"Mon Jan 02 15:04:05 -0700 2006"
RFC822
=
"02 Jan 06 1504 MST"
// RFC822 with Zulu time.
RFC8
22Z
=
"02 Jan 06 1504 -0700
"
RFC
850
=
"Monday, 02-Jan-
06 15:04:05 MST"
RFC1123
=
"Mon, 02 Jan 2006 15:04:05 MST"
RFC3339
=
"2006-01-02T15:04:05Z07:00"
Kitchen
=
"3:04PM"
RFC822Z
=
"02 Jan 06 1504 -0700"
// RFC822 with numeric zone
RFC8
50
=
"Monday, 02-Jan-06 15:04:05 MST
"
RFC
1123
=
"Mon, 02 Jan 20
06 15:04:05 MST"
RFC1123
Z
=
"Mon, 02 Jan 2006 15:04:05 -0700"
// RFC1123 with numeric zone
RFC3339
=
"2006-01-02T15:04:05Z07:00"
Kitchen
=
"3:04PM"
// Handy time stamps.
Stamp
=
"Jan _2 15:04:05"
StampMilli
=
"Jan _2 15:04:05.000"
...
...
src/pkg/time/time_test.go
View file @
a7e473be
...
...
@@ -201,6 +201,7 @@ var formatTests = []FormatTest{
{
"RFC822"
,
RFC822
,
"04 Feb 09 2100 PST"
},
{
"RFC850"
,
RFC850
,
"Wednesday, 04-Feb-09 21:00:57 PST"
},
{
"RFC1123"
,
RFC1123
,
"Wed, 04 Feb 2009 21:00:57 PST"
},
{
"RFC1123Z"
,
RFC1123Z
,
"Wed, 04 Feb 2009 21:00:57 -0800"
},
{
"RFC3339"
,
RFC3339
,
"2009-02-04T21:00:57-08:00"
},
{
"Kitchen"
,
Kitchen
,
"9:00PM"
},
{
"am/pm"
,
"3pm"
,
"9pm"
},
...
...
@@ -240,6 +241,7 @@ var parseTests = []ParseTest{
{
"RubyDate"
,
RubyDate
,
"Thu Feb 04 21:00:57 -0800 2010"
,
true
,
true
,
1
,
0
},
{
"RFC850"
,
RFC850
,
"Thursday, 04-Feb-10 21:00:57 PST"
,
true
,
true
,
1
,
0
},
{
"RFC1123"
,
RFC1123
,
"Thu, 04 Feb 2010 21:00:57 PST"
,
true
,
true
,
1
,
0
},
{
"RFC1123Z"
,
RFC1123Z
,
"Thu, 04 Feb 2010 21:00:57 -0800"
,
true
,
true
,
1
,
0
},
{
"RFC3339"
,
RFC3339
,
"2010-02-04T21:00:57-08:00"
,
true
,
false
,
1
,
0
},
{
"custom:
\"
2006-01-02 15:04:05-07
\"
"
,
"2006-01-02 15:04:05-07"
,
"2010-02-04 21:00:57-08"
,
true
,
false
,
1
,
0
},
// Optional fractional seconds.
...
...
@@ -248,6 +250,7 @@ var parseTests = []ParseTest{
{
"RubyDate"
,
RubyDate
,
"Thu Feb 04 21:00:57.012 -0800 2010"
,
true
,
true
,
1
,
3
},
{
"RFC850"
,
RFC850
,
"Thursday, 04-Feb-10 21:00:57.0123 PST"
,
true
,
true
,
1
,
4
},
{
"RFC1123"
,
RFC1123
,
"Thu, 04 Feb 2010 21:00:57.01234 PST"
,
true
,
true
,
1
,
5
},
{
"RFC1123Z"
,
RFC1123Z
,
"Thu, 04 Feb 2010 21:00:57.01234 -0800"
,
true
,
true
,
1
,
5
},
{
"RFC3339"
,
RFC3339
,
"2010-02-04T21:00:57.012345678-08:00"
,
true
,
false
,
1
,
9
},
// Amount of white space should not matter.
{
"ANSIC"
,
ANSIC
,
"Thu Feb 4 21:00:57 2010"
,
false
,
true
,
1
,
0
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment