Java教程

Failed to convert value of type 'java.lang.String' to required type 'java.util.Date&#

本文主要是介绍Failed to convert value of type 'java.lang.String' to required type 'java.util.Date&#,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

后台接收Date数据,用String 类型接收,写入时转换格式

String-》Date,先进行格式修改,再利用parse转换为Date

      java.text.SimpleDateFormat ft = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
        Date date=ft.parse(businessDate);

传输数据格式与前台数据相同

Date->String

Date date=ft.format(businessDate);

 遇到Unparseable date:“2021-08-08”

前端传来的数据结构与,设置的结构不相同,报错。

这篇关于Failed to convert value of type 'java.lang.String' to required type 'java.util.Date&#的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!