Month.
Inheritance: Enum
Exemplo n.º 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) {}
 }
Exemplo n.º 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();
 }
Exemplo n.º 3
0
Arquivo: DateTime.cs Projeto: xored/f4
 public static long weekdayInMonth(long year, Month mon, Weekday weekday, long pos)
 {
     return weekdayInMonth((int)year, mon.ord, weekday.ord, (int)pos);
 }
Exemplo n.º 4
0
Arquivo: DateTime.cs Projeto: xored/f4
 public static DateTime make(long year, Month month, long day, long hour, long min, long sec, long ns, TimeZone tz)
 {
     return new DateTime((int)year, month.ord, (int)day, (int)hour, (int)min, (int)sec, ns, System.Int32.MaxValue, tz);
 }
Exemplo n.º 5
0
Arquivo: DateTime.cs Projeto: xored/f4
 public static DateTime make(long year, Month month, long day, long hour, long min, long sec, long ns)
 {
     return make(year, month, day, hour, min, sec, ns, TimeZone.m_cur);
 }
Exemplo n.º 6
0
Arquivo: Date.cs Projeto: nomit007/f4
 public static Date make(long year, Month month, long day)
 {
     return new Date((int)year, month.ord, (int)day);
 }
Exemplo n.º 7
0
        private void parse(string s)
        {
            this.str = s;
              this.pos = 0;
              int len = pattern.Length;
              bool skippedLast = false;
              for (int i=0; i<len; ++i)
              {
            // character
            int c = pattern[i];

            // character count
            int n = 1;
            while (i+1<len && pattern[i+1] == c) { ++i; ++n; }

            // switch
            switch (c)
            {
              case 'Y':
            year = parseInt(n);
            if (year < 30) year += 2000;
            else if (year < 100) year += 1900;
            break;

              case 'M':
            switch (n)
            {
              case 4:  mon = parseMon(); break;
              case 3:  mon = parseMon(); break;
              default: mon = Month.array[parseInt(n)-1]; break;
            }
            break;

              case 'D':
            if (n != 3) day = parseInt(n);
            else
            {
              // suffix like st, nd, th
              day = parseInt(1);
              skipWord();
            }
            break;

              case 'h':
              case 'k':
            hour = parseInt(n);
            break;

              case 'm':
            min = parseInt(n);
            break;

              case 's':
            sec = parseInt(n);
            break;

              case 'S':
            if (!skippedLast) sec = parseInt(n);
            break;

              case 'a':
              case 'A':
            int amPm = str[pos]; pos += n;
            if (amPm == 'P' || amPm == 'p')
            {
              if (hour < 12) hour += 12;
            }
            else
            {
              if (hour == 12) hour = 0;
            }
            break;

              case 'W':
            skipWord();
            break;

              case 'f':
              case 'F':
            if (c == 'F' && skippedLast) break;
            ns = 0;
            int tenth = 100000000;
            while (true)
            {
              int digit = parseOptDigit();
              if (digit < 0) break;
              ns += tenth * digit;
              tenth /= 10;
            }
            break;

              case 'z':
            switch (n)
            {
              case 1:  parseTzOffset(); break;
              default: parseTzName(); break;
            }
            break;

              case '\'':
            while (true)
            {
              int expected = pattern[++i];
              if (expected == '\'') break;
              int actual = str[pos++];
              if (actual != expected) throw new Exception();
            }
            break;

              default:
            int match = pos+1 < str.Length ? str[pos++] : 0;

            // handle skipped symbols
            if (i+1 < pattern.Length)
            {
              int next = pattern[i+1];
              if (next == 'F' || next == 'S')
              {
                if (match != c) { skippedLast = true; --pos; break; }
              }
            }

            skippedLast = false;
            if (match != c) throw new Exception();
            break;
            }

              }
        }
Exemplo n.º 8
0
 public static long weekdayInMonth(long year, Month mon, Weekday weekday, long pos)
 {
     return(weekdayInMonth((int)year, mon.ord, weekday.ord, (int)pos));
 }
Exemplo n.º 9
0
 public static DateTime make(long year, Month month, long day, long hour, long min, long sec, long ns, TimeZone tz)
 {
     return(new DateTime((int)year, month.ord, (int)day, (int)hour, (int)min, (int)sec, ns, System.Int32.MaxValue, tz));
 }
Exemplo n.º 10
0
 public static DateTime make(long year, Month month, long day, long hour, long min, long sec, long ns)
 {
     return(make(year, month, day, hour, min, sec, ns, TimeZone.m_cur));
 }