Package java.util

Examples of java.util.Calendar


        Time tStartTime = (Time)hm.get("Start");
        Time tEndTime = (Time)hm.get("End");

        java.util.Date dt = (java.util.Date)hm.get("Date");

        Calendar calendarStart = Calendar.getInstance();
        calendarStart.set(dt.getYear(), dt.getMonth(), dt.getDay(), tStartTime.getHours(),
            tStartTime.getMinutes());

        Calendar calendarEnd = Calendar.getInstance();
        calendarEnd.set(dt.getYear(), dt.getMonth(), dt.getDay(), tEndTime.getHours(), tEndTime
            .getMinutes());

        long startMili = calendarStart.getTimeInMillis();
        long endMili = calendarEnd.getTimeInMillis();

        long diff = endMili - startMili;

        Time difTime = new Time(diff);

        int startHrs = calendarStart.get(Calendar.HOUR_OF_DAY);// startHrsmm[0];
        int startMins = calendarStart.get(Calendar.MINUTE);// startHrsmm[1];

        int endHrs = calendarEnd.get(Calendar.HOUR_OF_DAY);// endHrsmm[0];
        int endMins = calendarEnd.get(Calendar.MINUTE);// endHrsmm[1];

        float Duration = 0;

        Number dBreakTime = (Number)hm.get("BreakTime");
        float BreakTime = dBreakTime.floatValue();
View Full Code Here


        Time tStartTime = (Time)hm.get("Start");
        Time tEndTime = (Time)hm.get("End");

        java.util.Date dt = (java.util.Date)hm.get("Date");

        Calendar calendarStart = Calendar.getInstance();
        calendarStart.set(dt.getYear(), dt.getMonth(), dt.getDay(), tStartTime.getHours(),
            tStartTime.getMinutes());

        Calendar calendarEnd = Calendar.getInstance();
        calendarEnd.set(dt.getYear(), dt.getMonth(), dt.getDay(), tEndTime.getHours(), tEndTime
            .getMinutes());

        long startMili = calendarStart.getTimeInMillis();
        long endMili = calendarEnd.getTimeInMillis();

        long diff = endMili - startMili;
        Time difTime = new Time(diff);

        int startHrs = calendarStart.get(Calendar.HOUR_OF_DAY);// startHrsmm[0];
        int startMins = calendarStart.get(Calendar.MINUTE);// startHrsmm[1];

        int endHrs = calendarEnd.get(Calendar.HOUR_OF_DAY);// endHrsmm[0];
        int endMins = calendarEnd.get(Calendar.MINUTE);// endHrsmm[1];

        float Duration = 0;

        Double dBreakTime = (Double)hm.get("BreakTime");
        float BreakTime = dBreakTime.floatValue();
View Full Code Here

        Time tStartTime = (Time)hm.get("Start");
        Time tEndTime = (Time)hm.get("End");

        java.util.Date dt = (java.util.Date)hm.get("Date");

        Calendar calendarStart = Calendar.getInstance();
        calendarStart.set(dt.getYear(), dt.getMonth(), dt.getDay(), tStartTime.getHours(),
            tStartTime.getMinutes());

        Calendar calendarEnd = Calendar.getInstance();
        calendarEnd.set(dt.getYear(), dt.getMonth(), dt.getDay(), tEndTime.getHours(), tEndTime
            .getMinutes());

        long startMili = calendarStart.getTimeInMillis();
        long endMili = calendarEnd.getTimeInMillis();

        long diff = endMili - startMili;
        Time difTime = new Time(diff);
        int startHrs = calendarStart.get(Calendar.HOUR_OF_DAY);// startHrsmm[0];
        int startMins = calendarStart.get(Calendar.MINUTE);// startHrsmm[1];

        int endHrs = calendarEnd.get(Calendar.HOUR_OF_DAY);// endHrsmm[0];
        int endMins = calendarEnd.get(Calendar.MINUTE);// endHrsmm[1];

        float Duration = 0;

        Double dBreakTime = (Double)hm.get("BreakTime");
        float BreakTime = dBreakTime.floatValue();
View Full Code Here

   * @param month
   * @param date
   * @return
   */
  public boolean is_today(int year, int month, int date){
    Calendar today = Calendar.getInstance();
    today.set(Calendar.YEAR, year);
    today.set(Calendar.MONTH, month - 1);
    today.set(Calendar.DATE, date);
    return is_today(today.getTime());
  }
View Full Code Here

   * @param fromIdx
   * @param count
   * @return
   */
  public static List listHotTopics(int fromIdx, int count, int days){
    Calendar cur_time = Calendar.getInstance();
    cur_time.add(Calendar.DATE, -days);
    return executeNamedQuery("HOT_TOPICS", fromIdx,count, new Object[]{new Integer(TopicOutlineBean.STATUS_NORMAL), cur_time.getTime()});   
  }
View Full Code Here

    Session ssn = getSession();
    try{
      Query q = ssn.createQuery(hql.toString());
      q.setInteger(0, site.getId());
      q.setInteger(1, TopicOutlineBean.STATUS_NORMAL);
      Calendar cur_time = Calendar.getInstance();
      cur_time.add(Calendar.DATE, -days);
      q.setTimestamp(2, new Timestamp(cur_time.getTime().getTime()));
      if(forum != null)
        q.setInteger(3, forum.getId());
      if(fromIdx > 0)
        q.setFirstResult(fromIdx);
      q.setMaxResults(count);
View Full Code Here

    long[] ds = LunarCalendar.today();
    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(0);
    nf.setMinimumIntegerDigits(2);
    String nongli = nf.format(ds[1]) + nf.format(ds[2]);
    Calendar cal = Calendar.getInstance();
    String yangli = nf.format(cal.get(Calendar.MONTH)+1)+nf.format(cal.get(Calendar.DATE));
    //System.out.printf("nongli=%s,yangli=%s\r\n",nongli,yangli);
    String f_nl = getMessage(request, "festival", 'Y'+nongli);
    String f_yl = getMessage(request, "festival", yangli);
    if(f_nl!=null && f_yl!=null)
      return f_yl + "," + f_nl;
View Full Code Here

   * @param formatter
   * @return
   */
  public String format_now_month(String formatter) {
    SimpleDateFormat sdf = new SimpleDateFormat(formatter, Locale.ENGLISH);
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.DATE, 1);
    return sdf.format(cal.getTime());
  }
View Full Code Here

     */
    public static Time createTime(java.util.Date date) {
        if (date instanceof Time) {
            return (Time)date;
        }
        Calendar cal = getCalendar();
        cal.setTime(date);
        return normalizeTime(date, cal);
    }
View Full Code Here

     */
    public static Date createDate(java.util.Date date) {
        if (date instanceof Date) {
            return (Date)date;
        }
        Calendar cal = getCalendar();
        cal.setTime(date);
        return normalizeDate(date, cal);
    }
View Full Code Here

TOP

Related Classes of java.util.Calendar

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.