Package java.text

Examples of java.text.SimpleDateFormat.parseObject()


                    if (value.equals(sysdate)==false)
                    {   // Parse Date Time
                        String format = (col.getDataType()==DataType.DATE) ? "yyyy-MM-dd" : "yyyy-MM-dd HH:mm:ss.S";
                        SimpleDateFormat sdf = new SimpleDateFormat(format);
                        try {
                            value = sdf.parseObject(value.toString());
                        } catch(ParseException e) {
                            log.error("Failed to parse date for record", e);
                            continue;
                        }
                    }
View Full Code Here


                    if (value.equals(sysdate)==false)
                    {   // Parse Date Time
                        String format = (col.getDataType()==DataType.DATE) ? "yyyy-MM-dd" : "yyyy-MM-dd HH:mm:ss.S";
                        SimpleDateFormat sdf = new SimpleDateFormat(format);
                        try {
                            value = sdf.parseObject(value.toString());
                        } catch(ParseException e) {
                            log.error("Failed to parse date for record", e);
                            continue;
                        }
                    }
View Full Code Here

            "1974-01-01 11:20:34.0 GMT",
        };

        final String[] actual = new String[expected.length];
        for (int i = 0; i < actual.length; i++ ) {
            final String converted = converter.toString(format.parseObject(expected[i]));
            // Note, XStream's string representation of the date is in IST
            actual[i] = format.format(converter.fromString(converted));
        }
       
        assertEquals(Arrays.asList(expected).toString(), Arrays.asList(actual).toString());
View Full Code Here

                    if (value.equals(sysdate)==false)
                    {   // Parse Date Time
                        String format = (col.getDataType()==DataType.DATE) ? "yyyy-MM-dd" : "yyyy-MM-dd HH:mm:ss.S";
                        SimpleDateFormat sdf = new SimpleDateFormat(format);
                        try {
                            value = sdf.parseObject(value.toString());
                        } catch(ParseException e) {
                            log.error("Failed to parse date for record", e);
                            continue;
                        }
                    }
View Full Code Here

                String dateFormat = xPathIndexerPropertiesField.getDateFormat() == null?"dd.MM.yyyy":xPathIndexerPropertiesField.getDateFormat();
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
               
                // If not parseable set the date: 1. January 1970.
                try {
                  value = simpleDateFormat.parseObject(stringValue);
                } catch (ParseException e) {
                  value = new Date(0);
                }
               
                break;
View Full Code Here

    public StringBuffer format(Object pObj, StringBuffer pAppendTo, FieldPosition pPos) {
      return df.format(((Calendar) pObj).getTime(), pAppendTo, pPos);
    }
    public Object parseObject(String pSource, ParsePosition pPos) {
      Calendar cal = Calendar.getInstance();
      cal.setTime((Date) df.parseObject(pSource, pPos));
      return cal;
    }
    };
    final Format otherDateFormat = new Format(){
      private final DateFormat df = new SimpleDateFormat("yyyy.MMM.dd z");
View Full Code Here

      public StringBuffer format(Object pObj, StringBuffer pAppendTo, FieldPosition pPos) {
        return df.format(((Calendar) pObj).getTime(), pAppendTo, pPos);
      }
      public Object parseObject(String pSource, ParsePosition pPos) {
        Calendar cal = Calendar.getInstance();
        cal.setTime((Date) df.parseObject(pSource, pPos));
        return cal;
      }
    };
    final Format otherTimeFormat = new Format(){
      private static final long serialVersionUID = -6173879133371739286L;
View Full Code Here

      public StringBuffer format(Object pObj, StringBuffer pAppendTo, FieldPosition pPos) {
        return df.format(((Calendar) pObj).getTime(), pAppendTo, pPos);
      }
      public Object parseObject(String pSource, ParsePosition pPos) {
        Calendar cal = Calendar.getInstance();
        cal.setTime((Date) df.parseObject(pSource, pPos));
        return cal;
      }
    };
    testAllElement(otherDateTimeFormat, otherDateFormat, otherTimeFormat);
  }
View Full Code Here

    public StringBuffer format(Object pObj, StringBuffer pAppendTo, FieldPosition pPos) {
      return df.format(((Calendar) pObj).getTime(), pAppendTo, pPos);
    }
    public Object parseObject(String pSource, ParsePosition pPos) {
      Calendar cal = Calendar.getInstance();
      cal.setTime((Date) df.parseObject(pSource, pPos));
      return cal;
    }
    };
    final Format otherDateFormat = new Format(){
      private final DateFormat df = new SimpleDateFormat("yyyy.MMM.dd z");
View Full Code Here

      public StringBuffer format(Object pObj, StringBuffer pAppendTo, FieldPosition pPos) {
        return df.format(((Calendar) pObj).getTime(), pAppendTo, pPos);
      }
      public Object parseObject(String pSource, ParsePosition pPos) {
        Calendar cal = Calendar.getInstance();
        cal.setTime((Date) df.parseObject(pSource, pPos));
        return cal;
      }
    };
    final Format otherTimeFormat = new Format(){
      private static final long serialVersionUID = -6173879133371739286L;
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.