if add date then time the inputDate modify by default in 01/01/1970 08:00:00 During the commit
for Example:
DispDeb = 02/08/2019
and DispFin 02/08/2019
but time in DispDeb 08:00
and in DispFin 12:00
My Problem
if add date in DispDeb 02/08/2019
and Time
in inputText 08:00
change my date in DispDeb
and in DispFin
and in my commit add into the table DispDeb 01/01/1970 08:00
and DispFin 01/01/1970 12:00 Error javax.DateTimeConverter converter
<af:inputDate value="#{bindings.DispDeb.inputValue}"
binding="#{pageFlowScope.PlaningCalBean.dateDebvalue}"
id="id1" label="#{bindings.DispDeb.hints.label}" contentStyle="width:100px;" >
<af:convertDateTime pattern="dd/MM/yyyy"/>
</af:inputDate>'
<af:inputText label="Heure Début" id="it4" value="#{bindings.DispDeb.inputValue}"
contentStyle="width:50px;text-align:center;"
binding="#{pageFlowScope.PlaningCalBean.heursdateDebvalue}">
<af:convertDateTime pattern="HH:mm"/>
</af:inputText>
`
`
` public String savegarde() throws ParseException {
// Add event code here...
String DateDebut = null , DateDebHeurs = null , docDatesHeursFin = null ;
SimpleDateFormat ft = new SimpleDateFormat("HH:mm:ss");
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DateDebut = formatter.format(this.getDateDebvalue().getValue());
DateDebHeurs = ft.format(this.getHeursdateDebvalue().getValue());
docDatesHeursFin = ft.format(this.getHeursdatefinvalue().getValue());
int year=Integer.parseInt(DateDebut.split("/")[2]);
int month=Integer.parseInt(DateDebut.split("/")[1]);
int day=Integer.parseInt(DateDebut.split("/")[0]);
Integer hour = Integer.parseInt(DateDebHeurs.split(":")[0]);
Integer minute = Integer.parseInt(DateDebHeurs.split(":")[1]);
Integer second = Integer.parseInt(DateDebHeurs.split(":")[2]);
Integer hours = Integer.parseInt(docDatesHeursFin.split(":")[0]);
Integer minutes = Integer.parseInt(docDatesHeursFin.split(":")[1]);
Integer seconds = Integer.parseInt(docDatesHeursFin.split(":")[2]);
LocalDateTime dateTimez = LocalDateTime.of(year, month, day, hour, minute, second);
LocalDateTime dateTimezFin = LocalDateTime.of(year, month, day, hours, minutes, seconds);
System.out.println(dateTimez + " aloooo " + dateTimezFin);
Date date= Date.from(dateTimez.atZone(ZoneId.systemDefault()).toInstant());
Timestamp ts =new Timestamp(date.getTime());
Date datez= Date.from(dateTimezFin.atZone(ZoneId.systemDefault()).toInstant());
Timestamp tzs =new Timestamp(datez.getTime());
System.out.println(ts + " aloooo " + tzs);
oracle.adf.model.AttributeBinding dateDebutattr = (oracle.adf.model.AttributeBinding)bindings.getControlBinding("DispDeb");
dateDebutattr.setInputValue(ts);
BindingContainer bindingsss = getBindings();
OperationBinding operationBindingss = bindingsss.getOperationBinding("Commit");
operationBindingss.execute();
return null;
}``
Im not really sure what you're trying to do from the question but you can simplify converting
DispDeb = 02/08/2019 and DispDeb 08:00
Like this:
DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm")
.withZone(ZoneId.systemDefault());
String date = "2019/12/19";
String time = "12:00";
String dateTime = date + " " + time;
LocalDateTime localDateTime = LocalDateTime.parse(dateTime, DATE_TIME_FORMATTER);
System.out.println(localDateTime);
Timestamp timestamp = Timestamp.valueOf(localDateTime);
System.out.println(timestamp);
hope that helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.