Examples of Timestamp


Examples of java.sql.Timestamp

          && (promotionDetailListForm.getStartyear() != null)) {
        String startmonth = promotionDetailListForm.getStartmonth();
        String startday = promotionDetailListForm.getStartday();
        String startyear = promotionDetailListForm.getStartyear();
        try {
          Timestamp start = DateUtility.createTimestamp(startyear, startmonth, startday);
          promotionVO.setStartdate(start);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }

      if ((promotionDetailListForm.getEndmonth() != null)
          && (promotionDetailListForm.getEndday() != null)
          && (promotionDetailListForm.getEndyear() != null)) {
        String endmonth = promotionDetailListForm.getEndmonth();
        String endday = promotionDetailListForm.getEndday();
        String endyear = promotionDetailListForm.getEndyear();
        try {
          Timestamp end = DateUtility.createTimestamp(endyear, endmonth, endday);
          promotionVO.setEnddate(end);
        } catch (Exception e) {
          logger.error("[execute]: Exception", e);
        }
      }
View Full Code Here

Examples of java.sql.Timestamp

      if (invID == 0) {
        inventoryVO = remote.insertInventory(individualID, inventoryVO);
        invenForm.setInventoryID(inventoryVO.getInventoryID());

        Timestamp timeStamp = inventoryVO.getModified();
        Date date = inventoryVO.getCreated();

        if (inventoryVO.getCreated() != null)
          invenForm.setCreated(dForm.format(date));
View Full Code Here

Examples of java.sql.Timestamp

        throw new Exception("Bad category");
      catForm.setCategoryname(catVO.getTitle());
      catForm.setParentcatid(catVO.getParent());
     
      // Format created time
      Timestamp timeStamp = catVO.getCreatedOn();
      if (timeStamp != null){
        Date d = new Date(timeStamp.getTime());
        DateFormat df = new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a");
        catForm.setCreated(df.format(d));
      }
     
      // Format modified time
      timeStamp = catVO.getModifiedOn();
      if (timeStamp != null){
        Date d = new Date(timeStamp.getTime());
        DateFormat df = new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a");
        catForm.setModified(df.format(d));
      }
     
      catForm.setOwner(catVO.getOwnerVO().getFirstName() + " "
View Full Code Here

Examples of java.sql.Timestamp

   */
  public static Timestamp createTimestamp(String year, String month, String day, String hour, String min)
  {
    Calendar calendar = new GregorianCalendar(Integer.parseInt(year), Integer.parseInt(month) - 1,
        Integer.parseInt(day), Integer.parseInt(hour), Integer.parseInt(min));
    return new Timestamp(calendar.getTimeInMillis());
  }
View Full Code Here

Examples of java.sql.Timestamp

    return new Timestamp(calendar.getTimeInMillis());
  }

  public static Date createDate(String year, String month, String day)
  {
    Timestamp ts = DateUtility.createTimestamp(year, month, day);
    return new Date(ts.getTime());
  }
View Full Code Here

Examples of java.sql.Timestamp

      literatureform.setLiteraturenamevec(literaturenamevec);
      literatureform.setNames(strnames);

      if (literatureDetails.getDuebydate() != null)
      {
        Timestamp date = (Timestamp)literatureDetails.getDuebydate();

        String strMonth = "" + (date.getMonth() + 1);
        String strDay = "" + date.getDate();
        String strYear = "" + (date.getYear() + 1900);
        String strHours = "" + date.getHours();
        String strMins = "" + date.getMinutes();
        int hhmm[] = new int[2];
        hhmm[0] = Integer.parseInt(strHours.trim());
        hhmm[1] = Integer.parseInt(strMins.trim());
        String strTime = CVUtility.convertTime24HrsFormatToStr(hhmm);
        literatureform.setDuebymonth(strMonth);
View Full Code Here

Examples of java.sql.Timestamp

  private String decorateFormat(int index, List rowData, FieldDecoration decoration, String out)
  {
    Integer listTypeInteger = new Integer(this.listObject.getParameters().getValueListType());
    StringBuffer decoratedField = new StringBuffer();
    Date valueDate = null;
    Timestamp timeStamp = null;
    boolean flagUrl = true;
    String valueString = "";
    int decorationType = decoration.getFieldDecorationType();

    Object content = rowData.get(decoration.getParameter() - 1);

    switch (decorationType) {
      case FieldDecoration.urlType:
        String folderType = "";
        if (listTypeInteger.intValue() == ValueListConstants.FILE_LIST_TYPE && this.listObject.getLookupType() != null
            && this.listObject.getLookupType().equals("lookup")) {
          folderType = rowData.get(ValueListConstants.KB_FILE_EMAIL_HACK_INDEX - 1).toString();
          if (folderType != null && folderType.equals("FILE")) {
            flagUrl = false;
          }
        }

        if (flagUrl) {
          // display the string in Hyper link format
          decoratedField.append(ValueListConstants.ANCHOR_PART_OPEN);
          decoratedField.append("class=\"plainLink\" ");
          decoratedField.append("href=\"javascript:");
          decoratedField.append(decoration.getUrlOpen());
          valueString = content.toString();
          valueString = valueString.replaceAll("\"", """);

          // For file and knowledgebase lists we will append type parameter to
          // the url.
          if (listTypeInteger.intValue() == ValueListConstants.KNOWLEDGEBASE_LIST_TYPE
              || listTypeInteger.intValue() == ValueListConstants.FILE_LIST_TYPE) {
            valueString = valueString.concat("&type=" + rowData.get(ValueListConstants.KB_FILE_EMAIL_HACK_INDEX - 1));
            if (this.listObject.isLookup()) {
              valueString += ValueListConstants.AMP + "actionType=" + this.listObject.getLookupType();
            }
          }
          decoratedField.append(valueString);

          if (this.pageContext.findAttribute("listScope") != null) {
            decoratedField.append("&listScope=");
            decoratedField.append(this.request.getAttribute("listScope"));
          }

          if (this.listObject.getCurrentLinkParameters() != null && !this.listObject.getCurrentLinkParameters().equals("")) {
            decoratedField.append(this.listObject.getCurrentLinkParameters());
          }
          decoratedField.append(decoration.getUrlClose());
          decoratedField.append("\"");
          decoratedField.append(ValueListConstants.CLOSE);
          // For completed activities
          if (((listTypeInteger.intValue() == ValueListConstants.ACTIVITY_LIST_TYPE)
              || (listTypeInteger.intValue() == ValueListConstants.APPOINTMENT_LIST_TYPE)
              || (listTypeInteger.intValue() == ValueListConstants.CALL_LIST_TYPE)
              || (listTypeInteger.intValue() == ValueListConstants.FORECASTSALES_LIST_TYPE)
              || (listTypeInteger.intValue() == ValueListConstants.MEETING_LIST_TYPE)
              || (listTypeInteger.intValue() == ValueListConstants.NEXTACTION_LIST_TYPE)
              || (listTypeInteger.intValue() == ValueListConstants.TODO_LIST_TYPE) || (listTypeInteger.intValue() == ValueListConstants.TASK_LIST_TYPE))
              && (index == ValueListConstants.ACTIVITY_TITLE_INDEX)) {
            Object columnData = rowData.get(ValueListConstants.ACTIVITY_STATUS_INDEX - 1);
            if (((String) columnData).indexOf("Completed") != -1) {
              decoratedField.append(ValueListConstants.SPAN_PART_OPEN);
              decoratedField.append("class=\"completedActivity\" ");
              decoratedField.append(ValueListConstants.CLOSE);
              decoratedField.append(out);
              decoratedField.append(ValueListConstants.SPAN_CLOSE);
            } else {
              decoratedField.append(out);
              decoratedField.append(ValueListConstants.ANCHOR_CLOSE);
            }
          } else {
            decoratedField.append(out);
            decoratedField.append(ValueListConstants.ANCHOR_CLOSE);
          }
        } else {
          decoratedField.append(out);
        }
        break;
      case FieldDecoration.dateType: {
        // use the standard i18n way of formating these.
        // that means using the default formats based on locale.
        if (content != null) {
          DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, this.locale);
          if (content instanceof Timestamp) {
            timeStamp = (Timestamp) content;
            valueDate = new Date(timeStamp.getTime());
            valueString = df.format(valueDate);
          }
          if (content instanceof java.sql.Date) {
            java.sql.Date dateStamp = (java.sql.Date) content;
            valueString = df.format(dateStamp);
          }
          if (content instanceof Long) {
            Long dateObject = (Long) content;
            valueDate = new Date();
            valueDate.setTime(dateObject.longValue());
            valueString = df.format(valueDate);
          }
          decoratedField.append(valueString);
        }
        break;
      }
      case FieldDecoration.dateTimeType: {
        DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, this.locale);
        timeStamp = (Timestamp) content;
        if (timeStamp != null) {
          valueDate = new Date(timeStamp.getTime());
          valueString = df.format(valueDate);
        }
        decoratedField.append(valueString);
        break;
      }
      case FieldDecoration.timeType: {
        DateFormat df = DateFormat.getTimeInstance(DateFormat.MEDIUM, this.locale);
        if (content instanceof Timestamp) {
          timeStamp = (Timestamp) content;
          valueDate = new Date(timeStamp.getTime());
          if (timeStamp != null) {
            valueDate = new Date(timeStamp.getTime());
            valueString = df.format(valueDate);
          }
        }
        if (content instanceof Long) {
          Long dateObject = (Long) content;
          if (dateObject != null) {
            valueDate = new Date();
            valueDate.setTime(dateObject.longValue());
            valueString = df.format(dateObject);
          }
        }
        decoratedField.append(valueString);
        break;
      }
      case FieldDecoration.fileSizeType:
        // display the string to file Size
        // which in byte to GB,MB,KB
        float size = (new Float(content.toString())).floatValue();
        DecimalFormat df = new DecimalFormat("###.#");
        Integer s = new Integer((int) size);
        valueString = s.toString();
        if (size > 1000000000) {
          size /= 1073741824; // 1GB
          valueString = df.format(size) + "GB";
        } else if (size > 1000000) {
          size /= 1048576; // 1MB
          valueString = df.format(size) + "MB";
        } else if (size > 1000) {
          size /= 1024; // 1KB
          valueString = df.format(size) + "KB";
        }
        decoratedField.append(valueString);
        break;

      case FieldDecoration.moneyType:
        // display the string to currency format
        NumberFormat numFormatter = NumberFormat.getCurrencyInstance(this.locale);
        if (content == null) {
          content = "0";
        }
        valueString = content.toString();
        Double doubleValue = new Double(valueString);
        if (doubleValue != null) {
          String contentFormated = numFormatter.format(doubleValue.doubleValue());
          decoratedField.append(contentFormated);
        }
        break;
      case FieldDecoration.hourType:
        // We are using the old version of mysql we must have to do this..
        // In futher version of mysql 4.1.1 as the datediff function we can use
        // that, but now no choice
        // we have to do this calculation.

        int startTimeIndex = ((Integer) ValueListConstants.timeslipDurationCalc.get("Start")).intValue();
        int endTimeIndex = ((Integer) ValueListConstants.timeslipDurationCalc.get("End")).intValue();

        Object startTimeObject = rowData.get(startTimeIndex - 1);
        Object endTimeObject = rowData.get(endTimeIndex - 1);
        long startTime = 0;
        long endTime = 0;
        if (startTimeObject != null && startTimeObject instanceof Timestamp) {
          Timestamp startTimeStamp = (Timestamp) startTimeObject;
          if (startTimeStamp != null) {
            startTime = startTimeStamp.getTime();
          }
        }
        if (endTimeObject != null && endTimeObject instanceof Timestamp) {
          Timestamp endTimeStamp = (Timestamp) endTimeObject;
          if (endTimeStamp != null) {
            endTime = endTimeStamp.getTime();
          }
        }

        if (startTime != 0 && endTime != 0) {
          long diffTime = endTime - startTime;
View Full Code Here

Examples of java.sql.Timestamp

    setIsMileStone(dynaForm.getMilestone());

    setIndividualID(Integer.parseInt(dynaForm.getManagerID()));

    if (!dynaForm.getStartyear().equals("")) {
      Timestamp startTS = DateUtility.createTimestamp(dynaForm.getStartyear(), dynaForm
          .getStartmonth(), dynaForm.getStartday());
      setStart(CVUtility.convertTimeZone(startTS, TimeZone.getTimeZone(tz), TimeZone
          .getTimeZone("EST")));
    }
    if (!dynaForm.getEndyear().equals("")) {
      Timestamp endTS = DateUtility.createTimestamp(dynaForm.getEndyear(), dynaForm.getEndmonth(),
          dynaForm.getEndday());
      setEnd(CVUtility
          .convertTimeZone(endTS, TimeZone.getTimeZone(tz), TimeZone.getTimeZone("EST")));
    }
View Full Code Here

Examples of java.sql.Timestamp

      cvdal.setInt(1, searchVO.getModuleID());
      cvdal.setInt(2, individualID);
      cvdal.setInt(3, individualID);
      cvdal.setRealDate(4, new java.sql.Date(new Date().getTime()));
      cvdal.setInt(5, individualID);
      cvdal.setRealTimestamp(6, new Timestamp(new Date().getTime()));
      cvdal.setString(7, searchVO.getName());

      cvdal.executeUpdate();
      newSearchID = cvdal.getAutoGeneratedKey();
View Full Code Here

Examples of java.sql.Timestamp

      sqlString.append("SearchID = ?");
      cvdal.setSqlQuery(sqlString.toString());
      cvdal.setInt(1, searchVO.getModuleID());
      cvdal.setInt(2, searchVO.getOwnerID());
      cvdal.setInt(3, individualID);
      cvdal.setRealTimestamp(4, new Timestamp(new Date().getTime()));
      cvdal.setString(5, searchVO.getName());
      cvdal.setInt(6, searchVO.getSearchID());

      recordsAffected = cvdal.executeUpdate();
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.