Skip to content Skip to sidebar Skip to footer

Cant Convert String To Date In Android

final Object ret = task.getResult().get('ReturnExpiry'); returndate = String.valueOf(ret); SimpleDateFormat format = new SimpleDateFormat('yyyy-MM-dd HH:mm:ss');

Solution 1:

Your data doesn't match your pattern. update your pattern like this

SimpleDateFormatsdf=newSimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
        Datedate=null;
        try{
            date  = sdf.parse("Thu Jun 21 04:33:58 GMT+00:00 2018");
        }catch (Exception e){ e.printStackTrace(); }
        System.out.println("check..." + date;

Hope it will solve your problem

Post a Comment for "Cant Convert String To Date In Android"