Package com.caucho.util

Examples of com.caucho.util.QDate


    return -1;
  }

  private QDate allocateCalendar()
  {
    QDate cal = _localCalendar.getAndSet(null);

    if (cal == null)
      cal = QDate.createLocal();

    return cal;
View Full Code Here


        if (status.equals("200")) {
          String lastModified = (String) stream.getAttribute("last-modified");

          _cacheEntry.lastModified = 0;
          if (lastModified != null) {
            QDate date = QDate.getGlobalDate();
            synchronized (date) {
              _cacheEntry.lastModified = date.parseDate(lastModified);
            }
          }

          String length =  (String) stream.getAttribute("content-length");
          _cacheEntry.length = 0;
View Full Code Here

  /**
   * Returns the days in a given month.
   */
  public static int cal_days_in_month(int cal, int month, int year)
  {
    QDate date = new QDate();

    date.setYear(year);
    date.setMonth(month - 1);

    return date.getDaysInMonth();
  }
View Full Code Here

  /**
   * Returns the timestamp of easter.
   */
  public static long easter_date(@Optional("-1") int year)
  {
    QDate date = new QDate();
   
    if (year < 0) {
      date.setGMTTime(System.currentTimeMillis());
     
      year = date.getYear();
    }

    int y = year;

    int c = y / 100;
    int n = y - 19 * (y / 19);
    int k = (c - 17) / 25;
    int i = c - c /4 - (c - k) / 3 + 19 * n + 15;
    i = i - 30 * (i / 30);
    i = i - (i / 28) * (1 - ((i / 28) *
                             (29 / (i + 1)) *
                             ((21 - n) / 11)));

    int j = y + y / 4 + i + 2 - c + c / 4;
    j = j - 7 * (j / 7);
    int l = i - j;
    int m = 3 + (l + 40) / 44;
    int d = l + 28 - 31 * (m / 4);

    date.setYear(year);
    date.setMonth(m - 1);
    date.setDayOfMonth(d);

    return date.getGMTTime() / 1000;
  }
View Full Code Here

  /**
   * Returns an array of the current date.
   */
  public Value getdate(@Optional("time()") long time)
  {
    QDate date = new QDate(false);

    date.setLocalTime(1000 * time);

    ArrayValue array = new ArrayValueImpl();

    array.put("seconds", date.getSecond());
    array.put("minutes", date.getMinute());
    array.put("hours", date.getHour());
    array.put("mday", date.getDayOfMonth());
    array.put("wday", date.getDayOfWeek() - 1);
    array.put("mon", date.getMonth() + 1);
    array.put("year", date.getYear());
    array.put("yday", date.getDayOfYear());
    array.put("weekday", _fullDayOfWeek[date.getDayOfWeek() - 1]);
    array.put("month", _fullMonth[date.getMonth()]);
    array.put(LongValue.ZERO, LongValue.create(time));

    return array;
  }
View Full Code Here

                       @Optional() Value secondV,
                       @Optional() Value monthV,
                       @Optional() Value dayV,
                       @Optional() Value yearV)
  {
    QDate date = env.getGmtDate();
    long now = System.currentTimeMillis();

    date.setLocalTime(now);

    long gmtNow = date.getGMTTime();

    date.setGMTTime(gmtNow);

    setMktime(date, hourV, minuteV, secondV, monthV, dayV, yearV);

    return date.getGMTTime() / 1000L;
  }
View Full Code Here

  {
    if (isGMT) {
      return dateImpl(format, time, env.getGmtDate());
    }
    else {
      QDate calendar;
     
      if (env.getDefaultTimeZone() != null)
        calendar = new QDate(env.getDefaultTimeZone());
      else
        calendar = env.getLocalDate();

      return dateImpl(format, time, calendar);
    }
View Full Code Here

    long year;
    long wday;
    long yday;
    long isdst;

    QDate localCalendar = env.getLocalDate();

    localCalendar.setGMTTime(time);

    sec = localCalendar.getSecond();
    min = localCalendar.getMinute();
    hour = localCalendar.getHour();
    mday = localCalendar.getDayOfMonth();
    mon = localCalendar.getMonth();
    year = localCalendar.getYear();
    wday = localCalendar.getDayOfWeek();
    yday = localCalendar.getDayOfYear();
    isdst = localCalendar.isDST() ? 1 : 0;

    year = year - 1900;
    wday = wday - 1;
   
    ArrayValue value = new ArrayValueImpl();
View Full Code Here

                     @Optional("-1") int isDST)
  {
    if (isDST != -1)
      env.deprecatedArgument("isDST");

    QDate date = new QDate(true);

    long now = System.currentTimeMillis();

    date.setLocalTime(now);
   
    setMktime(date, hourV, minuteV, secondV, monthV, dayV, yearV);

    return date.getGMTTime() / 1000L;
  }
View Full Code Here

      if (now >= 0)
        now = 1000L * now;
      else
        now = System.currentTimeMillis();

      QDate date = new QDate(true);
      date.setGMTTime(now);

      if (timeString.equals("")) {
        date.setHour(0);
        date.setMinute(0);
        date.setSecond(0);

        return new LongValue(date.getGMTTime() / 1000L);
      }

      DateParser parser = new DateParser(timeString, date);

      return new LongValue(parser.parse() / 1000L);
View Full Code Here

TOP

Related Classes of com.caucho.util.QDate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.