在 Web 应用程序中,我使用 twitter bootstrap;在服务器端,我使用 spring REST。
我正在使用bootstrap-datetimejs。
我使用两种不同的日期格式。
$('#birthdatepicker').datetimepicker({
viewMode: 'years',
format: 'DD/MM/YYYY',
allowInputToggle: true
});
$('#expirationDateCard1, #expirationDateCard2').datetimepicker({
format: 'MM/YYYY'
});
当我通过 ajax 调用发布时,响应是:
"{"timestamp":1436453221365,"status":400,"error":"Bad Request","exception":"org.springframework.http.converter.HttpMessageNotReadableException","message":"Could not read document: Can not construct instance of java.util.Date from String value '09/07/2015': not a valid representation (error: Failed to parse Date value '09/07/2015': Can not parse date \"09/07/2015\": not compatible with any of standard forms (\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\", \"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\", \"EEE, dd MMM yyyy HH:mm:ss zzz\", \"yyyy-MM-dd\"))\n at [Source: java.io.PushbackInputStream@2e700ae1; line: 1, column: 83]
是否有一些实用程序可以自动进行转换?