Date format chaining 12 hours to 24 house in android

timefoemet(time)//methed


public static String chanhetimeFormat(String time){
        SimpleDateFormat displayFormat = new SimpleDateFormat("HH:mm");
        SimpleDateFormat parseFormat = new SimpleDateFormat("hh:mm a");
        Date date = null;
        if(time != null){
            try {
                date = parseFormat.parse(time);
             
                String ftime= displayFormat.format(date);
                return String.valueOf(ftime);
            } catch (ParseException e) {

                e.printStackTrace();

            }        
        }

        return null;
    }
Share:

No comments:

Post a Comment

Powered by Blogger.

Recent Posts

Unordered List

  • Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  • Aliquam tincidunt mauris eu risus.
  • Vestibulum auctor dapibus neque.

Theme Support

Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.