small problem here. I have an android countdown timer that works fine, but the issue is the countdown timer will be different between users/timezone. By this I mean, for every timezone, users of my app will see a different countdown that may end earlier or later relative to their timezone.I don't want this, I want it so all countdowns end at the same time for THIS movie release.
My code: Note: some code is omitted for brevity and please check out the comments below for some explanation of the code
// the current date and time
Calendar today = Calendar.getInstance();
// release.date is in milliseconds at 12am and in GMT, example: GMT: Friday, September 29, 2017 12:00:00 AM
long currentTimeMillis = today.getTimeInMillis();
long expiryTime = releaseDate.date - currentTimeMillis;
holder.mTextCountdown.setText("");
if (holder.timer != null) {
// Cancel if not null to stop flickering
holder.timer.cancel();
}
holder.timer = new CountDownTimer(expiryTime, 500) {
public void onTick(long millisUntilFinished) {
long seconds = millisUntilFinished / 1000; // reminder: 1 sec = 1000 millis
long minutes = seconds / 60;
long hours = minutes / 60;
long days = hours / 24;
String dayFormat = "days";
String hoursFormat = "hours";
if (days == 1) {
dayFormat = "day";
}
if (hours == 1) {
hoursFormat = "hour";
}
String time = days + " " + dayFormat + " : " + hours % 24 + " " + hoursFormat +" : " + minutes % 60 + " : " + seconds % 60;
holder.mTextCountdown.setText(time);
}
// Finished: counted down to 0
public void onFinish() {
holder.mTextCountdown.setText("Now out!");
}
}.start();
How can I count down a timer in GMT/UTC, where for every user it's sure to end at the same time?
Thank you