Package java.util

Examples of java.util.GregorianCalendar


    protected Timestamp getTimestamp(String day, String month, String year, String timeZone) {

        int startday   = Integer.parseInt(day);
        int startmonth = Integer.parseInt(month) - 1;
        int startyear  = Integer.parseInt(year);
        GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
        gc.set(startyear,startmonth,startday,0,0,0);
        return new  Timestamp(gc.getTimeInMillis());
    }
View Full Code Here


      dateFormat= "M/d/yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
        timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);


      String typeOfOperation = request.getParameter(AccountConstantKeys.TYPEOFOPERATION);
View Full Code Here

      dynaForm.set("whoshouldattend", eventDetails.getWhoshouldattend());
      dynaForm.set("maxattendees", "" + eventDetails.getMaxattendees());
      dynaForm.set("moderatorid", "" + eventDetails.getModeratorid());
      dynaForm.set("moderatorname", eventDetails.getModeratorname());

      Calendar calendar = new GregorianCalendar();

      if (eventDetails.getStartdate() != null)
      {
        Timestamp date = (Timestamp)eventDetails.getStartdate();
        calendar.setTimeInMillis(date.getTime());

        int[] hhmm = new int[2];
        hhmm[0] = calendar.get(Calendar.HOUR_OF_DAY);
        hhmm[1] = calendar.get(Calendar.MINUTE);

        String strTime = CVUtility.convertTime24HrsFormatToStr(hhmm);
        dynaForm.set("startmonth", Integer.toString(calendar.get(Calendar.MONTH) + 1));
        dynaForm.set("startday", Integer.toString(calendar.get(Calendar.DATE)));
        dynaForm.set("startyear", Integer.toString(calendar.get(Calendar.YEAR)));
        dynaForm.set("starttime", strTime);
      }

      if (eventDetails.getEnddate() != null)
      {
        Timestamp date = (Timestamp)eventDetails.getEnddate();
        calendar.setTimeInMillis(date.getTime());

        int[] hhmm = new int[2];
        hhmm[0] = calendar.get(Calendar.HOUR_OF_DAY);
        hhmm[1] = calendar.get(Calendar.MINUTE);

        String strTime = CVUtility.convertTime24HrsFormatToStr(hhmm);
        dynaForm.set("endmonth", Integer.toString(calendar.get(Calendar.MONTH) + 1));
        dynaForm.set("endday", Integer.toString(calendar.get(Calendar.DATE)));
        dynaForm.set("endyear", Integer.toString(calendar.get(Calendar.YEAR)));
        dynaForm.set("endtime", strTime);
      }

      if (eventDetails.getCreateddate() != null)
      {
        Timestamp date = (Timestamp)eventDetails.getCreateddate();
        calendar.setTimeInMillis(date.getTime());

        String month = getCalenderMonth(calendar.get(Calendar.MONTH) + 1);

        dynaForm.set("createddate", month + " " + Integer.toString(calendar.get(Calendar.DATE)) + ", " + Integer.toString(calendar.get(Calendar.YEAR)));
      }

      if (eventDetails.getModifieddate() != null)
      {
        Timestamp date = (Timestamp)eventDetails.getModifieddate();

        calendar.setTimeInMillis(date.getTime());

        String month = getCalenderMonth(calendar.get(Calendar.MONTH) + 1);

        dynaForm.set("modifieddate", month + " " + Integer.toString(calendar.get(Calendar.DATE)) + ", " + Integer.toString(calendar.get(Calendar.YEAR)));
      }

          if (!duplicateEvent)
          {
        try
View Full Code Here

      dateFormat= "M/d/yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
        timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);

      int expenseID = Integer.parseInt((String)request.getParameter("rowId"));
View Full Code Here

      dateFormat= "M/d/yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
        timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);

      String typeOfSave = null;
View Full Code Here

        }
        request.setAttribute("Type", type);
      }

      // Default start and end time. are today, 0:00 through tomorrow 0:00
      GregorianCalendar startTimeUser = new GregorianCalendar(tz);

      // Set the default starting day of week to Monday.
      // TODO: make a preference for the starting day of the week, and use it
      // here.
      startTimeUser.setFirstDayOfWeek(Calendar.MONDAY);
      startTimeUser.setTimeInMillis(System.currentTimeMillis());
      int currentDay = startTimeUser.get(Calendar.DATE);
      int currentMonth = startTimeUser.get(Calendar.MONTH);
      int currentYear = startTimeUser.get(Calendar.YEAR);

      GregorianCalendar currentDateCalendar = new GregorianCalendar(currentYear, currentMonth, currentDay);
      request.setAttribute("currentDate", currentDateCalendar);

      String monthName = CalendarUtil.getCalenderMonthName(currentMonth);
      calendardyna.set("currentDate", monthName + " " + currentDay + ", " + currentYear);
      calendardyna.set("currentDay", new Integer(currentDay));
      calendardyna.set("currentMonth", new Integer(currentMonth));
      calendardyna.set("currentMonthName", monthName);
      calendardyna.set("currentYear", new Integer(currentYear));

      // the sDay, sMonth and sYear is the date set by the navigation or
      // selection
      String selectedDay = request.getParameter("selectedDay");
      String selectedMonthName = request.getParameter("selectedMonthName");
      String selectedYear = request.getParameter("selectedYear");

      // Check to see is session exists, if not set to default
      if (session.getAttribute("selectedDay") == null) {
        session.setAttribute("selectedDay", (new Integer(currentDay)).toString());
      }

      if (session.getAttribute("selectedMonthName") == null) {
        session.setAttribute("selectedMonthName", monthName);
      }

      if (session.getAttribute("selectedYear") == null) {
        session.setAttribute("selectedYear", (new Integer(currentYear)).toString());
      }

      // If request passes in selected day, set session to new value
      if (selectedDay != null) {
        session.setAttribute("selectedDay", selectedDay);
      }

      if (selectedMonthName != null) {
        session.setAttribute("selectedMonthName", selectedMonthName);
      }

      if (selectedYear != null) {
        session.setAttribute("selectedYear", selectedYear);
      }

      // set local objects to value stored in session
      selectedDay = (String) session.getAttribute("selectedDay");
      selectedMonthName = (String) session.getAttribute("selectedMonthName");
      selectedYear = (String) session.getAttribute("selectedYear");

      int day = Integer.parseInt(selectedDay);
      int month = (selectedMonthName == null) ? currentMonth : CalendarUtil.getCalendarMonth(selectedMonthName);
      int year = (selectedYear == null) ? currentYear : Integer.parseInt(selectedYear);
      if (selectedMonthName == null) {
        selectedMonthName = CalendarUtil.getCalenderMonthName(currentMonth);
      }

      GregorianCalendar selectedDate = new GregorianCalendar(year, month, 1);
      request.setAttribute("selectedDate", selectedDate);
      request.setAttribute("showWeeklyColumn", new Boolean(true));
      calendardyna.set("selectedDate", selectedMonthName + " " + day + ", " + year);
      calendardyna.set("selectedDay", String.valueOf(day));
      calendardyna.set("selectedYear", String.valueOf(year));
      calendardyna.set("selectedMonthName", selectedMonthName);

      // Selected Day midnight
      startTimeUser.clear();
      startTimeUser.set(year, month, day);

      HashMap calendarNavBar = CalendarUtil.setCalendarNavBar(year, month, day, type);
      calendardyna.set("calendarNavBar", calendarNavBar.get("calendarNavBar"));
      calendardyna.set("headerList", calendarNavBar.get("headerList"));
      calendardyna.set("headerLinkList", calendarNavBar.get("headerLinkList"));
      calendardyna.set("dateList", calendarNavBar.get("dateList"));
      calendardyna.set("startDayOfWeek", calendarNavBar.get("startDayOfWeek"));

      GregorianCalendar endTimeUser = new GregorianCalendar(tz);
      endTimeUser.setTime(startTimeUser.getTime());
      endTimeUser.add(Calendar.DATE, 1); // Selected Day+1 midnight

      if (type.equals("DAILY")) {
        // Daily view, set the timespan to 15, 30 or 60
        // minutes per table row, based on the dropdown.
        if (request.getParameter("timespan") != null) {
          timespan = Integer.parseInt(request.getParameter("timespan"));
        }
        startTimeUser.set(year, month, day, 0, 0);
        endTimeUser.setTime(startTimeUser.getTime());
        endTimeUser.add(Calendar.DATE, 1);
        Final_Forward = ".view.calendar.dailylist";
      } else if (type.equals("MONTHLY")) {
        // Monthly View
        // That means timespan is 1440 for some reason. I guess
        // the math works out that way .. ?!
        timespan = 1440;
        // start is first of the month
        startTimeUser.set(year, month, 1, 0, 0);
        // end is first of NEXT month
        endTimeUser.setTime(startTimeUser.getTime());
        endTimeUser.add(Calendar.MONTH, 1);
        Final_Forward = ".view.calendar.monthlylist";
      } else if (type.equals("WEEKLY")) {
        // Weekly (NON-columnar) view
        // That means timespan is 1440 for some reason. I guess
        // the math works out that way .. ?!
        timespan = 1440;
        // in the non-columnar view we always start the week on Monday.
        startTimeUser.setFirstDayOfWeek(Calendar.MONDAY);
        startTimeUser = CalendarUtil.setToStartOfWeek(startTimeUser);
        endTimeUser.setTime(startTimeUser.getTime());
        endTimeUser.add(Calendar.DAY_OF_MONTH, 7);
        Final_Forward = ".view.calendar.weeklylist";
      } else if (type.equals("WEEKLYCOLUMNS")) {
        timespan = 60;
        startTimeUser.set(Calendar.DAY_OF_WEEK, startTimeUser.getFirstDayOfWeek());
        startTimeUser = CalendarUtil.setToStartOfWeek(startTimeUser);
        endTimeUser.setTime(startTimeUser.getTime());
        endTimeUser.add(Calendar.DAY_OF_MONTH, 7);
        Final_Forward = ".view.calendar.weeklycolumnarlist";
      } else if (type.equals("YEARLY")) {
        Final_Forward = ".view.calendar.yearlylist";
        return (mapping.findForward(Final_Forward));
      }
View Full Code Here

      dateFormat= "M/d/yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
      timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);


      int expenseFormID = Integer.parseInt((String)request.getParameter("rowId"));
View Full Code Here

      dateFormat= "MMMMMMMMM dd, yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
      timeZone = "EST";
       
      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);
           

      int invID = Integer.parseInt((String)request.getParameter("rowId"));
View Full Code Here

      dateFormat = "MMMMMMMMM dd, yyyy";
      String timeZone = userPref.getTimeZone();
      if (timeZone == null)
        timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);

      String typeOfSave = null;
View Full Code Here

      dateFormat= "M/d/yyyy";
      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
        timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);

      String typeOfSave = null;
View Full Code Here

TOP

Related Classes of java.util.GregorianCalendar

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.