0

I am receiving date and time format as mentioned below

2016-04-13T00:12:33+05:30

i need to convert above format to HH:MM:SS AM/PM

can any one guide me,your response will be appreciated......

  • 1
    Possible duplicate of [Android SimpleDateFormat, how to use it?](http://stackoverflow.com/questions/9277747/android-simpledateformat-how-to-use-it) – Mike M. Apr 13 '16 at 13:33
  • only follow the rules of API: http://developer.android.com/reference/java/text/SimpleDateFormat.html – Opiatefuchs Apr 13 '16 at 13:36

3 Answers3

0
SimpleDateFormat formatter = new SimpleDateFormat("hh:mm:ss a");
Log.i("date ====== " + formatter.format("2016-04-13T00:12:33+05:30"));
mdDroid
  • 3,135
  • 2
  • 22
  • 34
0

Android has the DateFormat class for parsing and reformatting dates as Strings, but JodaTime is much better. JodaTime is small and can handle what you're looking for in just a couple lines of code.

0

You need first String to Date using Simple forma tor

Then date need to change to formatResult fro expected result

 SimpleDateFormat format = new SimpleDateFormat("dd-M-yyyy hh:mm:ss", Locale.ENGLISH);

  SimpleDateFormat formatResult  = new SimpleDateFormat("hh:mm aa");
Surya Prakash Kushawah
  • 3,185
  • 1
  • 22
  • 42