Skip to content Skip to sidebar Skip to footer

Getting Simpledateformat For Specific Timezone

I am having a hard time displaying time for a specific timezone. I have a TV Guide like app that gets all start times of the programs in Unix epoch time from the server and I want

Solution 1:

Use setTimeZone():

SimpleDateFormatsimpleDateFormat=newSimpleDateFormat("HH:mm", newLocale("nl", "NL"));
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("Europe/Amsterdam"));

A related question: According to http://developer.android.com/reference/java/util/Locale.html I can't assume the nl_NL Locale is available on every device, how would I solve this?

Are you talking about the UI here? If so, then you can not solve it. Only Google and/or OEMs can add new locales to the system.

Post a Comment for "Getting Simpledateformat For Specific Timezone"