Package java.text

Examples of java.text.SimpleDateFormat


      // set the From: field on the form bean
      emailForm.set("from", message.getMailFrom());
     
      // set the Date: field on the form bean
      Timestamp messageTimestamp = (Timestamp)message.getMessageDate();
      SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");
      String date = dateFormatter.format(messageTimestamp);
      emailForm.set("date", date);
     
      // set the Subject: field on the form bean
      emailForm.set("subject", message.getSubject());
     
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 actionType = request.getParameter("actionType");
     
      if (request.getParameter("expenseFormID") != null)
      {
View Full Code Here

      invoiceForm.set("billingAddress", invoiceVO.getBillToAddress());
      invoiceForm.set("shippingAddress", invoiceVO.getShipToAddress());
      invoiceForm.set("status", invoiceVO.getStatusName());

      Date invoiceDate = (Date)invoiceVO.getInvoiceDate();
      SimpleDateFormat dateFormatter = new SimpleDateFormat("MMMMM dd, yyyy");
      String formattedDate = dateFormatter.format(invoiceDate);
      invoiceForm.set("date", formattedDate);

      int termID = invoiceVO.getTermId();
      invoiceForm.set("terms", termID+"");
      invoiceForm.set("accountManager", invoiceVO.getAccountManagerName());
View Full Code Here

            m_random = new Random(5);
            m_halfRangeFraction = fraction * 0.5;
            m_halfRangeFractionRoot = Math.sqrt(fraction) * 0.5;
            m_utcZone = TimeZone.getTimeZone("UTC");
            Calendar calendar = new GregorianCalendar(m_utcZone);
            m_format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            m_format.setCalendar(calendar);
            try {
                s_minDate = m_format.parse("2000-01-01 01:19:26").getTime();
                s_maxDate = m_format.parse("2003-08-31 23:07:59").getTime();
            } catch (ParseException e) {
View Full Code Here

    private void readQuakes(BufferedReader rdr)
        throws IOException, ParseException {
       
        // process actual quake listing input file
        Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        format.setCalendar(calendar);
        String line;
        while ((line = rdr.readLine()) != null) {
           
            // parse the date and milliseconds
            int mark = line.indexOf(' ');
            mark = line.indexOf(' ', mark+1);
            Date date = format.parse(line.substring(0, mark));
            line = line.substring(mark+1).trim();
            mark = line.indexOf(' ');
            int millis = Integer.parseInt(line.substring(0, mark));
            line = line.substring(mark+1).trim();
           
View Full Code Here

      dynaForm.set("groupdescription", groupVO.getDescription());
      dynaForm.set("groupid", (new Integer(groupVO.getGroupID())).toString());
      Date createdDate = groupVO.getCreatedate();
      Date modifiedDate = groupVO.getModifydate();
      // TODO common date formatter
      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM d, yyyy h:mm a");
      dynaForm.set("create", simpleDateFormat.format(createdDate));
      dynaForm.set("modify", simpleDateFormat.format(modifiedDate));
      dynaForm.set("owner", (new Integer(groupVO.getOwner())).toString());

      ListPreference listPreference = userObject.getListPreference("Individual");
      ListView view = listPreference.getListView(String.valueOf(listPreference.getDefaultView()));
      ValueListParameters listParameters = (ValueListParameters)request
View Full Code Here

    Locale locale = request.getLocale();
    String prefValue = userPrefs.getSyncAsPrivate();
    boolean syncAsPrivate = (prefValue != null && prefValue.equals("YES")) ? true : false;

    // date format for incoming dates: 2004-01-13 15:00:00
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    // date format for writing to the form should be in the format based on
    // locale
    DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, locale);
    DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT, locale);

    ActivityAddHandler requestForm = (ActivityAddHandler)form;
    String sessionID = requestForm.getSessionID();

    // check sessionid is matching or not
    if (userobjectd.getSessionID().equals(sessionID)) {
      ActivityForm activityForm = new ActivityForm();
      activityForm.setLocale(locale);
      String priority = requestForm.getPriority();

      // this is the string that we'll pass to the activityform
      // set to 2 (medium) by default
      String detailpriority = "2";

      if (priority != null) {
        // set the String integer value based on the String string value
        // (confused yet?)
        if (priority.equals("High")) {
          detailpriority = "1";
        } else if (priority.equals("Low")) {
          detailpriority = "3";
        }
      }

      String detailstatus = requestForm.getStatus();

      if (detailstatus == null) {
        detailstatus = "1";
      }

      if (detailstatus != null && !detailstatus.equals("")) {
        if (detailstatus.equals("Pending")) {
          detailstatus = "1";
        } else if (detailstatus.equals("Completed")) {
          detailstatus = "2";
        }
      }

      String detailtitle = requestForm.getTitle();
      String detaildetail = requestForm.getDescription();

      // startdate
      Calendar start = new GregorianCalendar(tz, locale);
      String activityStartDate = requestForm.getStartDateTime();
      if (activityStartDate != null && (!activityStartDate.equals(""))) {
        try {
          Date dd = simpleDateFormat.parse(activityStartDate);
          start.setTime(dd);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }
      activityForm.setActivityStartDate(df.format(start.getTime()));
      activityForm.setActivityStartTime(tf.format(start.getTime()));

      // enddate
      Calendar end = new GregorianCalendar(tz, locale);
      String activityenddate = requestForm.getEndDateTime();
      if (activityenddate != null && (!activityenddate.equals(""))) {
        try {
          Date dd = simpleDateFormat.parse(activityenddate);
          end.setTime(dd);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }
      activityForm.setActivityEndDate(df.format(end.getTime()));
      activityForm.setActivityEndTime(tf.format(end.getTime()));

      activityForm.setActivityPriority(detailpriority);
      activityForm.setActivityStatus(detailstatus);
      activityForm.setActivityTitle(detailtitle);
      activityForm.setActivityDetail(detaildetail);

      // alarm date time
      String alarmDateTime = requestForm.getAlarmDateTime(); // alarmDateTime
      // ="01/09/2003";
      if (alarmDateTime != null && (!alarmDateTime.equals(""))) {
        try {
          Date d = simpleDateFormat.parse(alarmDateTime);
          GregorianCalendar remind = new GregorianCalendar();
          remind.setTime(d);
          activityForm.setActivityRemindDate(df.format(remind.getTime()));
          activityForm.setActivityReminder("on");
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }

      // now, add the Activity to the database using our SyncFacade bean
      String linkCompany = requestForm.getLinkCompany();
      if (linkCompany == null) {
        activityForm.setLinkCompany(linkCompany);
      }

      // create an instance of our SyncFacade EJB
      SyncFacade syncfacade = new SyncFacade();
      syncfacade.setDataSource(dataSource);

      // now, add the Activity to the database using our SyncFacade bean
      String activitytype = requestForm.getType();
      if (activitytype == null) {
        activitytype = "Appointment";
      }
      String result = "";

      int individualID = userobjectd.getIndividualID();
      // Appointment
      if (activitytype.equals("Appointment")) {
        activityForm.setActivityType("1");
      }

      // Call
      if (activitytype.equals("Call")) {
        activityForm.setActivityType("2");
      }

      // Meeting
      if (activitytype.equals("Meeting")) {
        activityForm.setActivityType("5");
      }

      // ToDo
      if (activitytype.equals("To Do")) {
        activityForm.setActivityType("6");
      }

      // NextAction
      if (activitytype.equals("Next Action")) {
        activityForm.setActivityType("7");
      }

      result = syncfacade.addActivity(activityForm, individualID);

      com.centraview.syncfacade.SyncFacade sfremote = null;
      try {
        SyncFacadeHome syncHome = (SyncFacadeHome)CVUtility.getHomeObject(
            "com.centraview.syncfacade.SyncFacadeHome", "SyncFacade");
        sfremote = syncHome.create();
        sfremote.setDataSource(dataSource);
      } catch (Exception e) {
        logger.error("[execute]: Exception", e);
        writer.print("FAIL");
        return (null);
      }

      // Check to see if the user's preference is to create sync'ed
      // records as private. If so, delete all records from recordauthorisation
      // and publicrecords tables that link to the newly created records.
      if (syncAsPrivate) {
        ArrayList recordIDs = new ArrayList();
        try {
          recordIDs.add(new Integer(result));
        } catch (NumberFormatException nfe) {
          // don't need to do anything, because we obviously didn't add an
          // activity successfully.
          System.out.println("\n\n\nCAUGHT A NumberFormatException!!!!\n\n\n");
        }
        sfremote.markRecordsPrivate(3, recordIDs);
      }

      // we need to make all the Activities lists dirty, so that the next time
      // they are viewed, they are refreshed and contain the record we just
      // added
      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      lg.makeListDirty("MultiActivity");
      lg.makeListDirty("AllActivity");
      lg.makeListDirty("Appointment");
      lg.makeListDirty("Call");
      lg.makeListDirty("Meeting");
      lg.makeListDirty("NextAction");
      lg.makeListDirty("ToDo");

      // Now we check to see if this is a recurring activity.
      // Check the "recurrenceType" field. If it is not null,
      // then process the other recurring fields "every" and "on".
      // Then call the SyncFacadeEJB to add the recurring data
      // to the recurrence table.
      String recurrenceType = requestForm.getRecurrenceType();

      if (result != null && !result.equals("")) {
        // only do this if we actually created an activity above
        if (recurrenceType != null && !recurrenceType.equals("")) {
          // this is a recurring activity, get the other recurring fields
          String every = requestForm.getEvery();
          String recurrOn = requestForm.getOn();

          // NOTE: we do not care about recurringStartDate anymore, only copy
          // startDateTime into recurringStartDate
          String recurringStartDateString = requestForm.getStartDateTime();
          String recurringEndDateString = requestForm.getRecurrenceEndDate();

          Date recurringStartDate = null;
          Date recurringEndDate = null;

          try {
            recurringStartDate = simpleDateFormat.parse(recurringStartDateString);
            if (recurringEndDateString != null) {
              recurringEndDate = simpleDateFormat.parse(recurringEndDateString);
            } else {
              recurringEndDate = simpleDateFormat.parse("2099-12-31 00:00:00");
            }

            // NOTE: There is a bug in the CompanionLink Client API, that is
            // sending us the day of the month in the "every" field, instead of
            // the month of the year; when the recurring type is Yearly. To fix
View Full Code Here

       
        e.printStackTrace();
      }
    }
   
    SimpleDateFormat temp = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
    Logger.getLogger("azureus2").fatal("Azureus stopped at "+temp.format(new Date()));
    //System.exit(0);  - we don't want to force quit, wait until other threads have completed
    // so that resume data etc is saved....
  }
View Full Code Here

        isFirst = false;
      }

      if ( new_core != null ){
       
        SimpleDateFormat temp = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
       
        UIConst.startTime = new Date();
       
        Logger.getLogger("azureus2").fatal("Azureus started at "+temp.format(UIConst.startTime));
       
        UIConst.setAzureusCore( new_core );
      }

      uis = UIConst.UIS.values().iterator();
View Full Code Here

            case JAVAOBJECT:
                return value.toString();

            case DATE:

                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

                return format.format((Date) value);

            case NODE:
                return ((NodeHandle) value).getID();
        }
View Full Code Here

TOP

Related Classes of java.text.SimpleDateFormat

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.