asma
asma

Reputation: 113

Unparseable date in java

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 :

// 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?

Upvotes: 0

Views: 829

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240956

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

Upvotes: 2

Related Questions