Skip to content
Advertisement

Convert UTC into Local Time on Android

In my project, I have get the API response in json format. I get a string value of time in UTC time format like this Jul 16, 2013 12:08:59 AM.
I need to change this into Local time. That is where ever we use this the app needs to show the local time. How to I do this?

Here is some Code I have tried:

JavaScript

Assume aDate contains Jul 16, 2013 12:08:59 AM

Advertisement

Answer

Here’s my attempt:

JavaScript

Also notice the “a” for the am/pm marker…

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement