Convert timestamp to simple date in Java and add to ParseObject -
not duplicate: intended question address java.lang.illegalargumentexception
thrown when attempting add formatted date parseobject
rendering purposes.
i've got list of dates want display in more readable format when render them page. i.e. want wed mar 29 13:32:35 cest 2017
become wed mar 29
.
for (parseobject requestobject: requestsarraylist) { simpledateformat sdf = new simpledateformat("yyyy-mm-dd"); date date = null; try { date = sdf.parse(sdf.format(requestobject.getdate(parseconstantsutil.request_date_requested))); log.info(string.valueof(date)); } catch (java.text.parseexception e1) { e1.printstacktrace(); } requestobject.add(parseconstantsutil.request_date_requested, date); } requestobject.add(parseconstantsutil.request_date_requested, date);
i thought simpledateformat
enough can't ditch additional timestamp info , add object collection. should do?
exception:
java.lang.illegalargumentexception: not implemented! @ org.parse4j.operation.addoperation.apply(addoperation.java:26) ~[parse4j-1.5-snapshot.jar:na] @ org.parse4j.parseobject.performoperation(parseobject.java:375) ~[parse4j-1.5-snapshot.jar:na] @ org.parse4j.parseobject.addall(parseobject.java:301) ~[parse4j-1.5-snapshot.jar:na] @ org.parse4j.parseobject.add(parseobject.java:296) ~[parse4j-1.5-snapshot.jar:na] @ com.nnit.automation.controller.indexcontroller.findrequestsbycurrentuser(indexcontroller.java:117) ~[classes/:na] @ com.nnit.automation.controller.indexcontroller.findrequestsbycurrentuser(indexcontroller.java:61) ~[classes/:na] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.8.0_121] @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) ~[na:1.8.0_121] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.8.0_121] @ java.lang.reflect.method.invoke(method.java:498) ~[na:1.8.0_121]
we can convert date string in needed format , add requestobject
sample updated
for (parseobject requestobject: requestsarraylist) { simpledateformat sdf2 = new simpledateformat("e mmm dd"); string date = null; try { date = sdf.format(requestobject.getdate(parseconstantsutil.request_date_requested)); log.info(string.valueof(date)); } catch (java.text.parseexception e1) { e1.printstacktrace(); } requestobject.add(parseconstantsutil.request_date_requested, date); }
Comments
Post a Comment