Package com.caucho.util

Examples of com.caucho.util.QDate


  /**
   * Returns an array of the current date.
   */
  public Value getdate(Env env, @Optional Value timeV)
  {
    QDate date = env.getDate();
   
    long time;
   
    if (timeV.isDefault())
      time = env.getCurrentTime();
    else
      time = timeV.toLong() * 1000L;
   
    date.setGMTTime(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 / 1000L));

    return array;
  }
View Full Code Here


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

    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 = env.getDate();

      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

    if (isDST != -1)
      env.deprecatedArgument("isDST");

    long now = env.getCurrentTime();
   
    QDate date = env.getDate();
    date.setGMTTime(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 = env.getCurrentTime();

      QDate date = env.getDate();
      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

    if (maxAge == 0) {
      cookieHeader.append("; expires=Thu, 01-Dec-1994 16:00:00 GMT");
    }
    else {
      QDate date = env.getGmtDate();
     
      date.setGMTTime(now + 1000L * (long) maxAge);
      cookieHeader.append("; expires=");
      cookieHeader.append(date.format("%a, %d-%b-%Y %H:%M:%S GMT"));
    }

    if (path != null && ! path.equals("")) {
      cookieHeader.append("; path=");
      cookieHeader.append(path);
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

      if (! _isLineBegin) {
      }
      else if (_isRecordBegin) {
        long start = _stream.getPosition();

        QDate localDate = QDate.allocateLocalDate();

        localDate.setGMTTime(now);

        int len = _timestamp.length;
        for (int j = 0; j < len; j++) {
          _timestamp[j].print(_stream, localDate);
        }
View Full Code Here

    // Jump to start time.
    if ((_start != -1) && (now < _start)) {
      now = _start;
    }

    QDate calendar = allocateCalendar();

    // Round up to seconds.
    long time = now + 1000 - now % 1000;

    calendar.setGMTTime(time);

    QDate nextTime = getNextTime(calendar);

    if (nextTime != null) {
      time = nextTime.getGMTTime();
      time -= _timezone.getRawOffset(); // Adjust for time zone specification.
    } else {
      time = Long.MAX_VALUE; // This trigger is inactive.
    }
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.