Package com.caucho.util

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


  }
 
  public static Value date_parse(String date)
  {
    DateTime dateTime = new DateTime(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

    else
      now = System.currentTimeMillis();

    StringBuilder sb = new StringBuilder();

    QDate localDate = QDate.allocateLocalDate();

    localDate.setGMTTime(now);

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

    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

  }
 
  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

    this(env, timeString, new DateTimeZone(env));
  }
 
  protected DateTime(Env env, String timeString, DateTimeZone dateTimeZone)
  {
    _qDate = new QDate(dateTimeZone.getTimeZone(), env.getCurrentTime());
    _dateTimeZone = dateTimeZone;
   
    init(env, timeString);
  }
View Full Code Here

 
  public String format(String format)
  {
    long time = _qDate.getGMTTime() / 1000;
   
    QDate calendar = new QDate(_qDate.getLocalTimeZone());

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

  {
    _dateTimeZone = dateTimeZone;
   
    long time = _qDate.getGMTTime();
   
    _qDate = new QDate(dateTimeZone.getTimeZone(), env.getCurrentTime());
    _qDate.setGMTTime(time);
  }
View Full Code Here

   * Returns the days in a given month.
   */
  public static int cal_days_in_month(Env env,
                                      int cal, int month, int year)
  {
    QDate date = env.getDate();
    date.setGMTTime(env.getCurrentTime());
   
    date.setYear(year);
    date.setMonth(month - 1);

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

  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

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.