2008-09-17 17:20:00 -06:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// The time package provides functionality for measuring and
|
|
|
|
// displaying time.
|
2008-09-17 17:20:00 -06:00
|
|
|
package time
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os";
|
|
|
|
)
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// Seconds reports the number of seconds since the Unix epoch,
|
|
|
|
// January 1, 1970 00:00:00 UTC.
|
2009-01-20 15:40:40 -07:00
|
|
|
func Seconds() int64 {
|
2009-09-15 10:41:59 -06:00
|
|
|
sec, _, err := os.Time();
|
2008-12-08 18:45:50 -07:00
|
|
|
if err != nil {
|
2009-11-09 13:07:39 -07:00
|
|
|
panic("time: os.Time: ", err.String())
|
2008-12-08 18:45:50 -07:00
|
|
|
}
|
2009-10-07 12:55:06 -06:00
|
|
|
return sec;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// Nanoseconds reports the number of nanoseconds since the Unix epoch,
|
|
|
|
// January 1, 1970 00:00:00 UTC.
|
2009-01-20 15:40:40 -07:00
|
|
|
func Nanoseconds() int64 {
|
2008-12-08 18:45:50 -07:00
|
|
|
sec, nsec, err := os.Time();
|
|
|
|
if err != nil {
|
2009-11-09 13:07:39 -07:00
|
|
|
panic("time: os.Time: ", err.String())
|
2008-12-08 18:45:50 -07:00
|
|
|
}
|
2009-10-07 12:55:06 -06:00
|
|
|
return sec*1e9 + nsec;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// Days of the week.
|
2009-01-20 15:40:40 -07:00
|
|
|
const (
|
2009-10-07 12:55:06 -06:00
|
|
|
Sunday = iota;
|
2008-09-17 17:20:00 -06:00
|
|
|
Monday;
|
|
|
|
Tuesday;
|
|
|
|
Wednesday;
|
|
|
|
Thursday;
|
|
|
|
Friday;
|
|
|
|
Saturday;
|
|
|
|
)
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// Time is the struct representing a parsed time value.
|
2009-01-20 15:40:40 -07:00
|
|
|
type Time struct {
|
2009-10-07 12:55:06 -06:00
|
|
|
Year int64; // 2008 is 2008
|
|
|
|
Month, Day int; // Sep-17 is 9, 17
|
|
|
|
Hour, Minute, Second int; // 10:43:12 is 10, 43, 12
|
|
|
|
Weekday int; // Sunday, Monday, ...
|
|
|
|
ZoneOffset int; // seconds east of UTC
|
|
|
|
Zone string;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
2009-10-07 12:55:06 -06:00
|
|
|
var nonleapyear = []int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
|
|
|
|
var leapyear = []int{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-01-16 11:14:12 -07:00
|
|
|
func months(year int64) []int {
|
2008-09-17 17:20:00 -06:00
|
|
|
if year%4 == 0 && (year%100 != 0 || year%400 == 0) {
|
2009-11-09 13:07:39 -07:00
|
|
|
return leapyear
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
2009-10-07 12:55:06 -06:00
|
|
|
return nonleapyear;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
2009-10-07 12:55:06 -06:00
|
|
|
secondsPerDay = 24*60*60;
|
|
|
|
daysPer400Years = 365*400 + 97;
|
|
|
|
daysPer100Years = 365*100 + 24;
|
|
|
|
daysPer4Years = 365*4 + 1;
|
|
|
|
days1970To2001 = 31*365 + 8;
|
2008-09-17 17:20:00 -06:00
|
|
|
)
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// SecondsToUTC converts sec, in number of seconds since the Unix epoch,
|
|
|
|
// into a parsed Time value in the UTC time zone.
|
2009-01-20 15:40:40 -07:00
|
|
|
func SecondsToUTC(sec int64) *Time {
|
2009-01-06 16:19:02 -07:00
|
|
|
t := new(Time);
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Split into time and day.
|
2009-10-07 12:55:06 -06:00
|
|
|
day := sec / secondsPerDay;
|
|
|
|
sec -= day * secondsPerDay;
|
2008-09-17 17:20:00 -06:00
|
|
|
if sec < 0 {
|
2008-10-07 13:31:31 -06:00
|
|
|
day--;
|
2009-10-07 12:55:06 -06:00
|
|
|
sec += secondsPerDay;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Time
|
2009-01-26 12:22:21 -07:00
|
|
|
t.Hour = int(sec/3600);
|
|
|
|
t.Minute = int((sec/60)%60);
|
|
|
|
t.Second = int(sec%60);
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Day 0 = January 1, 1970 was a Thursday
|
2009-10-07 12:55:06 -06:00
|
|
|
t.Weekday = int((day+Thursday)%7);
|
2009-01-26 12:22:21 -07:00
|
|
|
if t.Weekday < 0 {
|
2009-11-09 13:07:39 -07:00
|
|
|
t.Weekday += 7
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Change day from 0 = 1970 to 0 = 2001,
|
|
|
|
// to make leap year calculations easier
|
|
|
|
// (2001 begins 4-, 100-, and 400-year cycles ending in a leap year.)
|
2009-02-16 17:32:30 -07:00
|
|
|
day -= days1970To2001;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2008-10-07 13:31:31 -06:00
|
|
|
year := int64(2001);
|
2008-09-17 17:20:00 -06:00
|
|
|
if day < 0 {
|
|
|
|
// Go back enough 400 year cycles to make day positive.
|
2009-10-07 12:55:06 -06:00
|
|
|
n := -day / daysPer400Years + 1;
|
2008-09-17 17:20:00 -06:00
|
|
|
year -= 400*n;
|
2009-10-07 12:55:06 -06:00
|
|
|
day += daysPer400Years * n;
|
2008-09-17 17:20:00 -06:00
|
|
|
} else {
|
|
|
|
// Cut off 400 year cycles.
|
2009-10-07 12:55:06 -06:00
|
|
|
n := day / daysPer400Years;
|
2008-09-17 17:20:00 -06:00
|
|
|
year += 400*n;
|
2009-10-07 12:55:06 -06:00
|
|
|
day -= daysPer400Years * n;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Cut off 100-year cycles
|
2009-10-07 12:55:06 -06:00
|
|
|
n := day / daysPer100Years;
|
2008-09-17 17:20:00 -06:00
|
|
|
year += 100*n;
|
2009-10-07 12:55:06 -06:00
|
|
|
day -= daysPer100Years * n;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Cut off 4-year cycles
|
2009-10-07 12:55:06 -06:00
|
|
|
n = day / daysPer4Years;
|
2008-09-17 17:20:00 -06:00
|
|
|
year += 4*n;
|
2009-10-07 12:55:06 -06:00
|
|
|
day -= daysPer4Years * n;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Cut off non-leap years.
|
|
|
|
n = day/365;
|
|
|
|
year += n;
|
|
|
|
day -= 365*n;
|
|
|
|
|
2009-01-26 12:22:21 -07:00
|
|
|
t.Year = year;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// If someone ever needs yearday,
|
|
|
|
// tyearday = day (+1?)
|
|
|
|
|
2009-01-16 11:14:12 -07:00
|
|
|
months := months(year);
|
2008-09-17 17:20:00 -06:00
|
|
|
var m int;
|
|
|
|
yday := int(day);
|
|
|
|
for m = 0; m < 12 && yday >= months[m]; m++ {
|
2009-11-09 13:07:39 -07:00
|
|
|
yday -= months[m]
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
2009-01-26 12:22:21 -07:00
|
|
|
t.Month = m+1;
|
|
|
|
t.Day = yday+1;
|
2009-02-15 23:12:35 -07:00
|
|
|
t.Zone = "UTC";
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// UTC returns the current time as a parsed Time value in the UTC time zone.
|
2009-11-06 15:24:38 -07:00
|
|
|
func UTC() *Time { return SecondsToUTC(Seconds()) }
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// SecondsToLocalTime converts sec, in number of seconds since the Unix epoch,
|
|
|
|
// into a parsed Time value in the local time zone.
|
2009-01-20 15:40:40 -07:00
|
|
|
func SecondsToLocalTime(sec int64) *Time {
|
2009-08-10 23:02:51 -06:00
|
|
|
z, offset := lookupTimezone(sec);
|
2008-09-17 17:20:00 -06:00
|
|
|
t := SecondsToUTC(sec+int64(offset));
|
2009-02-15 23:12:35 -07:00
|
|
|
t.Zone = z;
|
2009-01-26 12:22:21 -07:00
|
|
|
t.ZoneOffset = offset;
|
2009-10-07 12:55:06 -06:00
|
|
|
return t;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// LocalTime returns the current time as a parsed Time value in the local time zone.
|
2009-11-06 15:24:38 -07:00
|
|
|
func LocalTime() *Time { return SecondsToLocalTime(Seconds()) }
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// Seconds returns the number of seconds since January 1, 1970 represented by the
|
|
|
|
// parsed Time value.
|
2008-09-17 17:20:00 -06:00
|
|
|
func (t *Time) Seconds() int64 {
|
|
|
|
// First, accumulate days since January 1, 2001.
|
|
|
|
// Using 2001 instead of 1970 makes the leap-year
|
2008-10-07 13:31:31 -06:00
|
|
|
// handling easier (see SecondsToUTC), because
|
2008-09-17 17:20:00 -06:00
|
|
|
// it is at the beginning of the 4-, 100-, and 400-year cycles.
|
|
|
|
day := int64(0);
|
|
|
|
|
|
|
|
// Rewrite year to be >= 2001.
|
2009-01-26 12:22:21 -07:00
|
|
|
year := t.Year;
|
2008-09-17 17:20:00 -06:00
|
|
|
if year < 2001 {
|
2009-10-07 12:55:06 -06:00
|
|
|
n := (2001-year)/400 + 1;
|
2008-09-17 17:20:00 -06:00
|
|
|
year += 400*n;
|
2009-10-07 12:55:06 -06:00
|
|
|
day -= daysPer400Years * n;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add in days from 400-year cycles.
|
2009-10-07 12:55:06 -06:00
|
|
|
n := (year-2001)/400;
|
2008-09-17 17:20:00 -06:00
|
|
|
year -= 400*n;
|
2009-10-07 12:55:06 -06:00
|
|
|
day += daysPer400Years * n;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Add in 100-year cycles.
|
2009-10-07 12:55:06 -06:00
|
|
|
n = (year-2001)/100;
|
2008-09-17 17:20:00 -06:00
|
|
|
year -= 100*n;
|
2009-10-07 12:55:06 -06:00
|
|
|
day += daysPer100Years * n;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Add in 4-year cycles.
|
2009-10-07 12:55:06 -06:00
|
|
|
n = (year-2001)/4;
|
2008-09-17 17:20:00 -06:00
|
|
|
year -= 4*n;
|
2009-10-07 12:55:06 -06:00
|
|
|
day += daysPer4Years * n;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Add in non-leap years.
|
2009-10-07 12:55:06 -06:00
|
|
|
n = year-2001;
|
2008-09-17 17:20:00 -06:00
|
|
|
day += 365*n;
|
|
|
|
|
|
|
|
// Add in days this year.
|
2009-01-26 12:22:21 -07:00
|
|
|
months := months(t.Year);
|
2009-10-07 12:55:06 -06:00
|
|
|
for m := 0; m < t.Month - 1; m++ {
|
2009-11-09 13:07:39 -07:00
|
|
|
day += int64(months[m])
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
2009-01-26 12:22:21 -07:00
|
|
|
day += int64(t.Day - 1);
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Convert days to seconds since January 1, 2001.
|
2009-02-16 17:32:30 -07:00
|
|
|
sec := day * secondsPerDay;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Add in time elapsed today.
|
2009-10-08 16:14:54 -06:00
|
|
|
sec += int64(t.Hour)*3600;
|
|
|
|
sec += int64(t.Minute)*60;
|
2009-01-26 12:22:21 -07:00
|
|
|
sec += int64(t.Second);
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Convert from seconds since 2001 to seconds since 1970.
|
2009-02-16 17:32:30 -07:00
|
|
|
sec += days1970To2001 * secondsPerDay;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
// Account for local time zone.
|
2009-01-26 12:22:21 -07:00
|
|
|
sec -= int64(t.ZoneOffset);
|
2009-10-07 12:55:06 -06:00
|
|
|
return sec;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
2009-03-03 09:39:12 -07:00
|
|
|
var longDayNames = []string{
|
2008-09-17 17:20:00 -06:00
|
|
|
"Sunday",
|
|
|
|
"Monday",
|
|
|
|
"Tuesday",
|
|
|
|
"Wednesday",
|
|
|
|
"Thursday",
|
|
|
|
"Friday",
|
2009-10-07 12:55:06 -06:00
|
|
|
"Saturday",
|
2009-03-03 09:39:12 -07:00
|
|
|
}
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-03-03 09:39:12 -07:00
|
|
|
var shortDayNames = []string{
|
2008-09-17 17:20:00 -06:00
|
|
|
"Sun",
|
|
|
|
"Mon",
|
|
|
|
"Tue",
|
|
|
|
"Wed",
|
|
|
|
"Thu",
|
|
|
|
"Fri",
|
2009-10-07 12:55:06 -06:00
|
|
|
"Sat",
|
2009-03-03 09:39:12 -07:00
|
|
|
}
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-03-03 09:39:12 -07:00
|
|
|
var shortMonthNames = []string{
|
2009-09-14 17:45:35 -06:00
|
|
|
"---",
|
2008-09-17 17:20:00 -06:00
|
|
|
"Jan",
|
|
|
|
"Feb",
|
|
|
|
"Mar",
|
|
|
|
"Apr",
|
|
|
|
"May",
|
|
|
|
"Jun",
|
|
|
|
"Jul",
|
|
|
|
"Aug",
|
|
|
|
"Sep",
|
|
|
|
"Oct",
|
|
|
|
"Nov",
|
2009-10-07 12:55:06 -06:00
|
|
|
"Dec",
|
2009-03-03 09:39:12 -07:00
|
|
|
}
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-02-16 17:32:30 -07:00
|
|
|
func copy(dst []byte, s string) {
|
2008-09-17 17:20:00 -06:00
|
|
|
for i := 0; i < len(s); i++ {
|
2009-11-09 13:07:39 -07:00
|
|
|
dst[i] = s[i]
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-16 17:32:30 -07:00
|
|
|
func decimal(dst []byte, n int) {
|
2008-09-17 17:20:00 -06:00
|
|
|
if n < 0 {
|
2009-11-09 13:07:39 -07:00
|
|
|
n = 0
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
for i := len(dst)-1; i >= 0; i-- {
|
|
|
|
dst[i] = byte(n%10 + '0');
|
2009-10-07 12:55:06 -06:00
|
|
|
n /= 10;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-16 17:32:30 -07:00
|
|
|
func addString(buf []byte, bp int, s string) int {
|
2008-09-17 17:20:00 -06:00
|
|
|
n := len(s);
|
2009-10-07 12:55:06 -06:00
|
|
|
copy(buf[bp : bp+n], s);
|
|
|
|
return bp+n;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Just enough of strftime to implement the date formats below.
|
|
|
|
// Not exported.
|
2009-02-16 17:32:30 -07:00
|
|
|
func format(t *Time, fmt string) string {
|
2009-01-06 16:19:02 -07:00
|
|
|
buf := make([]byte, 128);
|
2008-10-07 13:31:31 -06:00
|
|
|
bp := 0;
|
2008-09-17 17:20:00 -06:00
|
|
|
|
|
|
|
for i := 0; i < len(fmt); i++ {
|
|
|
|
if fmt[i] == '%' {
|
2008-10-07 13:31:31 -06:00
|
|
|
i++;
|
2008-09-17 17:20:00 -06:00
|
|
|
switch fmt[i] {
|
|
|
|
case 'A': // %A full weekday name
|
2009-11-09 13:07:39 -07:00
|
|
|
bp = addString(buf, bp, longDayNames[t.Weekday])
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'a': // %a abbreviated weekday name
|
2009-11-09 13:07:39 -07:00
|
|
|
bp = addString(buf, bp, shortDayNames[t.Weekday])
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'b': // %b abbreviated month name
|
2009-11-09 13:07:39 -07:00
|
|
|
bp = addString(buf, bp, shortMonthNames[t.Month])
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'd': // %d day of month (01-31)
|
2009-10-07 12:55:06 -06:00
|
|
|
decimal(buf[bp : bp+2], t.Day);
|
2008-10-07 13:31:31 -06:00
|
|
|
bp += 2;
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'e': // %e day of month ( 1-31)
|
2009-01-26 12:22:21 -07:00
|
|
|
if t.Day >= 10 {
|
2009-11-09 13:07:39 -07:00
|
|
|
decimal(buf[bp : bp+2], t.Day)
|
2008-09-17 17:20:00 -06:00
|
|
|
} else {
|
|
|
|
buf[bp] = ' ';
|
2009-10-07 12:55:06 -06:00
|
|
|
buf[bp+1] = byte(t.Day + '0');
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
2008-10-07 13:31:31 -06:00
|
|
|
bp += 2;
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'H': // %H hour 00-23
|
2009-10-07 12:55:06 -06:00
|
|
|
decimal(buf[bp : bp+2], t.Hour);
|
2008-10-07 13:31:31 -06:00
|
|
|
bp += 2;
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'M': // %M minute 00-59
|
2009-10-07 12:55:06 -06:00
|
|
|
decimal(buf[bp : bp+2], t.Minute);
|
2008-10-07 13:31:31 -06:00
|
|
|
bp += 2;
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'S': // %S second 00-59
|
2009-10-07 12:55:06 -06:00
|
|
|
decimal(buf[bp : bp+2], t.Second);
|
2008-10-07 13:31:31 -06:00
|
|
|
bp += 2;
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'Y': // %Y year 2008
|
2009-10-07 12:55:06 -06:00
|
|
|
decimal(buf[bp : bp+4], int(t.Year));
|
2008-10-07 13:31:31 -06:00
|
|
|
bp += 4;
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'y': // %y year 08
|
2009-10-07 12:55:06 -06:00
|
|
|
decimal(buf[bp : bp+2], int(t.Year % 100));
|
2008-10-07 13:31:31 -06:00
|
|
|
bp += 2;
|
2008-09-17 17:20:00 -06:00
|
|
|
case 'Z':
|
2009-11-09 13:07:39 -07:00
|
|
|
bp = addString(buf, bp, t.Zone)
|
2008-09-17 17:20:00 -06:00
|
|
|
default:
|
|
|
|
buf[bp] = '%';
|
|
|
|
buf[bp+1] = fmt[i];
|
2009-10-07 12:55:06 -06:00
|
|
|
bp += 2;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
buf[bp] = fmt[i];
|
2008-10-07 13:31:31 -06:00
|
|
|
bp++;
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
}
|
2009-10-07 12:55:06 -06:00
|
|
|
return string(buf[0:bp]);
|
2008-09-17 17:20:00 -06:00
|
|
|
}
|
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// Asctime formats the parsed time value in the style of
|
2008-09-17 17:20:00 -06:00
|
|
|
// ANSI C asctime: Sun Nov 6 08:49:37 1994
|
2009-11-06 15:24:38 -07:00
|
|
|
func (t *Time) Asctime() string { return format(t, "%a %b %e %H:%M:%S %Y") }
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// RFC850 formats the parsed time value in the style of
|
2009-02-16 17:32:30 -07:00
|
|
|
// RFC 850: Sunday, 06-Nov-94 08:49:37 UTC
|
2009-11-06 15:24:38 -07:00
|
|
|
func (t *Time) RFC850() string { return format(t, "%A, %d-%b-%y %H:%M:%S %Z") }
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// RFC1123 formats the parsed time value in the style of
|
2009-02-16 17:32:30 -07:00
|
|
|
// RFC 1123: Sun, 06 Nov 1994 08:49:37 UTC
|
2009-11-06 15:24:38 -07:00
|
|
|
func (t *Time) RFC1123() string { return format(t, "%a, %d %b %Y %H:%M:%S %Z") }
|
2008-09-17 17:20:00 -06:00
|
|
|
|
2009-03-07 17:56:05 -07:00
|
|
|
// String formats the parsed time value in the style of
|
2009-02-16 17:32:30 -07:00
|
|
|
// date(1) - Sun Nov 6 08:49:37 UTC 1994
|
2009-11-06 15:24:38 -07:00
|
|
|
func (t *Time) String() string { return format(t, "%a %b %e %H:%M:%S %Z %Y") }
|