I have input date which is in set in ZoneDateTime
format, and it is converted to Date Time format. Now I need to set the value from database which is date that has time too (Timestamp). How to set the out?
inputs:
private ZonedDateTime StrtDate;
public void ZonedDateTime getStrtDate(){
return StrtDateGmt
}
public void ZonedDateTime setStrtDate(ZonedDateTime StrtDateGmt){
this.StrtDate=StrtDate;
}
conversion:
public static String formatDateString(ZonedDateTime date){
String result="";
if(date!=null){
DateTimeFormatter fmt=DateTimeFormatter.ofPattern(DATE_FORMAT);
res=date.format(fmt);
if(date.getOffset()!=null){
result+="";
result+=Integer.toString(date.getOffset().getTotalSeconds()/3600;}}
result result;
}
// setting/mapping the output from db:
// i have written in this way
dBtable.setstrtDate((ZonedDateTime)response.get(P_Strt_Dt);
How to set the output from datebase which has date in timestamp format
I was getting exception: date cannot be cast to ZonedDateTime. I don't know whether it is correct or not. How to set the output?