Saturday, 28 May 2016

Change Time format 24 hours to 12 hours

Change Time format 24 hours to 12 hours



public static String convertToEventFormat(String date) {
    String finaldate = null;
    try {
           SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.US);
        Date date1 = fmt.parse(date);
        SimpleDateFormat fmtOut = new SimpleDateFormat("dd-MM-yyyy hh:mm aa",Locale.US);
        finaldate = fmtOut.format(date1);

    } catch (ParseException e) {
        e.printStackTrace();
    }

    return finaldate;

}

No comments:

Post a Comment

Run/install/debug Android applications over Wi-Fi ?

Open Teminal/cmd --------------- Below steps is for Android 10 or lower Step 1 - Connect the device via USB and make sure debugging is work...