-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
  • 114,158
  • 16
  • 130
  • 208

2 Answers2

1

you can use

Calendar cal = Calendar.getInstance();
  cal.setTime(date);
PSR
  • 39,804
  • 41
  • 111
  • 151
1

You can do something like this:-

Calendar cal  = Calendar.getInstance();
cal.setTime(date);
Rahul
  • 44,383
  • 11
  • 84
  • 103