Weekday.
Inheritance: Enum
Beispiel #1
0
 internal DateTimeStr(string pattern, Locale locale, Date d)
 {
     this.pattern  = pattern;
       this.m_locale = locale;
       this.year     = d.getYear();
       this.mon      = d.month();
       this.day      = d.getDay();
       try { this.weekday = d.weekday(); } catch (Exception) {}
 }
Beispiel #2
0
 //////////////////////////////////////////////////////////////////////////
 // Constructors
 //////////////////////////////////////////////////////////////////////////
 internal DateTimeStr(string pattern, Locale locale, DateTime dt)
 {
     this.pattern  = pattern;
       this.m_locale = locale;
       this.year     = dt.getYear();
       this.mon      = dt.month();
       this.day      = dt.getDay();
       this.hour     = dt.getHour();
       this.min      = dt.getMin();
       this.sec      = dt.getSec();
       this.ns       = dt.getNanoSec();
       this.weekday  = dt.weekday();
       this.tz       = dt.tz();
       this.dst      = dt.dst();
 }
Beispiel #3
0
        internal static int weekOfYear(int year, int month, int day, Weekday startOfWeek)
        {
            int firstWeekday = DateTime.firstWeekday(year, 0); // zero based
              int lastDayInFirstWeek = 7 - (firstWeekday - startOfWeek.ord);

              // special case for first week
              if (month == 0 && day <= lastDayInFirstWeek) return 1;

              // compute from dayOfYear - lastDayInFirstWeek
              int doy = dayOfYear(year, month, day) + 1;
              int woy = (doy - lastDayInFirstWeek - 1) / 7;
              return woy + 2; // add first week and make one based
        }
Beispiel #4
0
 public long weekOfYear(Weekday startOfWeek)
 {
     return weekOfYear(getYear(), month().ord, getDay(), startOfWeek);
 }
Beispiel #5
0
 public static long weekdayInMonth(long year, Month mon, Weekday weekday, long pos)
 {
     return weekdayInMonth((int)year, mon.ord, weekday.ord, (int)pos);
 }
Beispiel #6
0
 public long weekOfYear(Weekday startOfWeek)
 {
     return(DateTime.weekOfYear(getYear(), month().ord, getDay(), startOfWeek));
 }
Beispiel #7
0
 public long weekOfYear()
 {
     return(weekOfYear(Weekday.localeStartOfWeek()));
 }
Beispiel #8
0
 public static long weekdayInMonth(long year, Month mon, Weekday weekday, long pos)
 {
     return(weekdayInMonth((int)year, mon.ord, weekday.ord, (int)pos));
 }