开发者

Unparseable date in java

开发者 https://www.devze.com 2023-03-13 14:53 出处:网络
I\'m using java studio creator to build my application. I used the ajax component, Popup Calendar, and when I want to get the date and compare it with another date , I cann\'t :(.

I'm using java studio creator to build my application. I used the ajax component, Popup Calendar, and when I want to get the date and compare it with another date , I cann't :(. This is my code :

/开发者_如何学JAVA/ My Code

  SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");

  java.util.Calendar startDate = java.util.Calendar.getInstance(); 
  startDate.setTime(dateFormat.parse(startField.getValue().toString()));   
//

Where startField is the calendar..

I tried to set the dateformattedpattern in the properties of the calendar to be the same as dataformat but it gave an exception.

Is there any suggestions to fix the problem?


startField.getValue().toString() should be of the form yyyy/MM/dd

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号