Closed reki-cool closed 5 years ago
I take Gson to solve them, the local-time field looks ok, but the local-date field looks so stanger
"localTime": "18:21:17.0",
"localDate": "Date [year\u003d118, month\u003dOCTOBER, day\u003d21, dayOfWeek\u003dSUNDAY]"
You comment is fairly vague but if you are just trying to convert a com.serotonin.bacnet4j.type.primitive.Date to a formatted String you would probably want to first make sure that it is actually a specific date instead of a matching pattern, then you can convert it to a GregorianCalendar and use standard java tools to print out whatever format you need.
private String formatDate(com.serotonin.bacnet4j.type.primitive.Date date) {
if(date.isSpecific(){
GregorianCalendar gc = date.calculateGC();
}else{
throw new Exception("Impossible");
}
}
thank you very much! @terrypacker
when I take Gson searlize the 'localData', it's show as
Date [year\u003d118, month\u003dOCTOBER, day\u003d21, dayOfWeek\u003dSUNDAY]
. how can i convert it to the styleyyyy-MM-dd