我正在尝试使用这个jquery输入掩码插件来提交一个日期时间字段。
所提交的资料如下:
081220151530 --2015年12月8日下午3:30
或者在上午/下午提交081220150330p
我正在尝试将该值绑定到Joda DateTime字段,并且我认为我应该能够在字段注释中指定一个自定义模式。
但是这个模式不匹配并引发验证错误:
@org.springframework.format.annotation.DateTimeFormat(pattern = "DDMMYYYYhhmm")
private DateTime followUp;错误:
Failed to convert property value of type 'java.lang.String' to required type 'org.joda.time.DateTime' for property 'followUp'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type @javax.persistence.Basic @org.hibernate.annotations.Type @org.springframework.format.annotation.DateTimeFormat org.joda.time.DateTime for value '081220151230'; nested exception is org.joda.time.IllegalFieldValueException: Cannot parse "081220151230": Value 22 for monthOfYear must be in the range [1,12]所以有两个问题: 1.理想情况下,它可以解析am/pm值,那么是否有一种模式与am/pm样式相匹配?
更新为原始问题:
所以我计算出了24H模式,使用DateFormat模式ddMMyyyyHHmm
但是第二部分我无法理解,所以我要将它重新分配到jquery-inputmask标记中,因为它将am/pm分别作为a和p提交,这可能是一个bug……
所以我想如果有人知道如何提交下午/上午时间,我可以解决这个问题吗?
发布于 2016-05-05 04:57:46
尝试: ddMMyyyyHHmma发布类似于05052016的值
https://stackoverflow.com/questions/31492230
复制相似问题