Hi I am working on set top box (STB) application where we need to convert UTC time to local time and display it on App.
From some third party API's we are getting time in UTC as String and we need to convert it to local time zone and display it on App.
below is the code :
after checking server logs till dateFormateInLocalTimeZone its working fine but String formattedTime = displayTime.format(d); after this line of code
the formattedTime var contains the time in UTC and not in local
I don't know what you expect "local" time to be, but if you don't specify a timezone in a SimpleDateFormat object then the JVM's default timezone is used. This is normally the timezone configured into the computer where the code is running.
And that timezone is not necessarily the timezone of the location where the server is located. Have you checked what the default timezone is in your server?