Examples of QDate


Examples of com.caucho.util.QDate

  public static long easter_date(Env env,
                                 @Optional("-1") int year)
  {
    long now = env.getCurrentTime();
   
    QDate date = env.getDate();
    date.setGMTTime(now);
   
    if (year < 0) {
      date.setGMTTime(now);
     
      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

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

Examples of com.caucho.util.QDate

                       @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

Examples of com.caucho.util.QDate

   
    if (isGMT) {
      return dateImpl(format, time, env.getGmtDate());
    }
    else {
      QDate calendar = env.getDate();

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

Examples of com.caucho.util.QDate

    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

Examples of com.caucho.util.QDate

    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

Examples of com.caucho.util.QDate

      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

Examples of com.caucho.util.QDate

    if (month > 12) {
      month -= 12;
      year += 1;
    }

    QDate localCalendar = env.getLocalDate();

    localCalendar.setHour(0);
    localCalendar.setMinute(0);
    localCalendar.setSecond(0);
    localCalendar.setDayOfMonth((int) day);
    localCalendar.setMonth((int) (month - 1));
    localCalendar.setYear((int) year);

    return localCalendar.getLocalTime() / 1000L;
  }
View Full Code Here

Examples of com.caucho.util.QDate

  }
 
  public static Value date_parse(Env env, String date)
  {
    DateTime dateTime = new DateTime(env, date);
    QDate qDate = dateTime.getQDate();
   
    ArrayValue array = new ArrayValueImpl();
   
    array.put("year", qDate.getYear());
    array.put("month", qDate.getMonth() + 1);
    array.put("day", qDate.getDayOfMonth());
    array.put("hour", qDate.getHour());
    array.put("minute", qDate.getMinute());
    array.put("second", qDate.getSecond());
    array.put("fraction", qDate.getMillisecond() / 1000.0);
   
    //warning_count
    //warnings
    //error_count
    //errors
View Full Code Here

Examples of com.caucho.util.QDate

  protected DateTime(Env env, String timeString, DateTimeZone dateTimeZone)
  {
    if (dateTimeZone == null)
      dateTimeZone = new DateTimeZone(env);
   
    _qDate = new QDate(dateTimeZone.getTimeZone(), env.getCurrentTime());
    _dateTimeZone = dateTimeZone;
   
    init(env, timeString);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.