Home | History | Annotate | Download | only in time

Lines Matching refs:Year

24 // The zero value of type Time is January 1, year 1, 00:00:00.000000000 UTC.
29 // presentation form of the time, such as in the Format, Hour, and Year methods.
42 // January 1, year 1 00:00:00 UTC.
51 // determine the minute, hour, month, day, and year
83 // A Month specifies a month of the year (January = 1, ...).
155 // January 1, year 1, 00:00:00.000000000 UTC
159 // non-negative year even in time zones west of UTC, unlike 1-1-0
171 // The presentation computations - year, month, minute, and so on - all
196 // The calendar runs on an exact 400 year cycle: a 400-year calendar
200 // long as possible. That means choosing a year equal to 1 mod 400, so
201 // that the first leap year is the 4th year, the first missed leap year
202 // is the 100th year, and the missed missed leap year is the 400th year.
210 // uses a year equal to 1 mod 400, and that is no more than 2?³ seconds
211 // earlier than 1970?bring us to the year -292277022399. We refer to
212 // this year as the absolute zero year, and to times measured as a uint64
213 // seconds since this year as absolute times.
215 // Times measured as an int64 seconds since the year 1?the representation
218 // Times measured as an int64 seconds since the year 1970 are called Unix
221 // It is tempting to just use the year 1 as the absolute epoch, defining
224 // west of UTC, since it is year 0. It doesn't seem tenable to say that
227 // the year -292277022399.
233 // The unsigned zero year for internal calculations.
238 // The year of the zero Time.
251 // January 1, year 1, 00:00:00 UTC.
300 // Date returns the year, month, and day in which t occurs.
301 func (t Time) Date() (year int, month Month, day int) {
302 year, month, day, _ = t.date(true)
306 // Year returns the year in which t occurs.
307 func (t Time) Year() int {
308 year, _, _, _ := t.date(false)
309 return year
312 // Month returns the month of the year specified by t.
331 // January 1 of the absolute year, like January 1 of 2001, was a Monday.
336 // ISOWeek returns the ISO 8601 year and week number in which t occurs.
337 // Week ranges from 1 to 53. Jan 01 to Jan 03 of year n might belong to
338 // week 52 or 53 of year n-1, and Dec 29 to Dec 31 might belong to week 1
339 // of year n+1.
340 func (t Time) ISOWeek() (year, week int) {
341 year, month, day, yday := t.date(true)
353 // Calculate week as number of Mondays in year up to
361 // that the first Monday of the year is in week 1.
370 // the last week of last year.
372 year--
374 // A year has 53 weeks when Jan 1 or Dec 31 is a Thursday,
375 // meaning Jan 1 of the next year is a Friday
376 // or it was a leap year and Jan 1 of the next year is a Saturday.
377 if jan1wday == Fri || (jan1wday == Sat && isLeap(year)) {
382 // December 29 to 31 are in week 1 of next year if
383 // they are after the last Thursday of the year and
387 year++
431 // YearDay returns the day of the year specified by t, in the range [1,365] for non-leap years,
672 year, month, day := t.Date()
674 return Date(year+years, month+Month(months), day+days, hour, min, sec, int(t.nsec), t.Location())
687 // date computes the year, day of year, and when full=true,
689 func (t Time) date(full bool) (year int, month Month, day int, yday int) {
694 func absDate(abs uint64, full bool) (year int, month Month, day int, yday int) {
698 // Account for 400 year cycles.
703 // Cut off 100-year cycles.
704 // The last cycle has one extra leap year, so on the last day
705 // of that year, day / daysPer100Years will be 4 instead of 3.
712 // Cut off 4-year cycles.
713 // The last cycle has a missing leap year, which does not
719 // Cut off years within a 4-year cycle.
720 // The last year is a leap year, so on the last day of that year,
728 year = int(int64(y) + absoluteZeroYear)
736 if isLeap(year) {
737 // Leap year
767 // daysBefore[m] counts the number of days in a non-leap year
769 // the number of days before January of next year (365).
786 func daysIn(m Month, year int) int {
787 if m == February && isLeap(year) {
849 // in nanoseconds cannot be represented by an int64 (a date before the year
950 if y := t.Year(); y < 0 || y >= 10000 {
953 return nil, errors.New("Time.MarshalJSON: year outside of range [0,9999]")
979 if y := t.Year(); y < 0 || y >= 10000 {
980 return nil, errors.New("Time.MarshalText: year outside of range [0,9999]")
1014 func isLeap(year int) bool {
1015 return year%4 == 0 && (year%100 != 0 || year%400 == 0)
1051 func Date(year int, month Month, day, hour, min, sec, nsec int, loc *Location) Time {
1056 // Normalize month, overflowing into year.
1058 year, m = norm(year, m, 12)
1067 y := uint64(int64(year) - absoluteZeroYear)
1071 // Add in days from 400-year cycles.
1076 // Add in 100-year cycles.
1081 // Add in 4-year cycles.
1092 if isLeap(year) && month >= March {