-5

I have the following code ,how should I change it from date to return type calendar ?

    Date date = new Date();

        SimpleDateFormat parsedDate = new SimpleDateFormat("yyyy-mm-dd");
        // TODO handle exception
        try {
            date = parsedDate.parse((String) memberValue);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return new SwitchInputType<Date>(date);
AlexR
  • 111,884
  • 15
  • 126
  • 200

2 Answers2

1

you can use

Calendar cal = Calendar.getInstance();
  cal.setTime(date);
PSR
  • 38,073
  • 36
  • 106
  • 149
1

You can do something like this:-

Calendar cal  = Calendar.getInstance();
cal.setTime(date);
Rahul
  • 43,125
  • 11
  • 82
  • 101