Questions tagged [countdown]

This tag refers to the process of counting down. In other words, the act of taking an initial value and then consistently subtracting a smaller value from it until the original value reaches a specified amount (usually 0).

Use this tag for questions that deal with counting down or countdown timers (a device that performs the countdown).

2279 questions
16
votes
4 answers

Simple Countdown Timer Typescript

I have the following code in my constructor: constructor(){ for (let i = 0; i < 90; i++) { setTimeout(() => { this.counter = this.counter - 1; }, 1000) } } What I actually want is to display a number which counts down 90 seconds. Right now…
Nicole W.
  • 267
  • 1
  • 4
  • 13
16
votes
2 answers

Angular 2 - Countdown timer

I am willing to do a countdown timer in Angular 2 that start from 60 (i.e 59, 58,57, etc...) For that I have the following: constructor(){ Observable.timer(0,1000).subscribe(timer=>{ this.counter = timer; }); } The above, ticks every second,…
Folky.H
  • 1,164
  • 4
  • 15
  • 37
16
votes
4 answers

Can't create handler inside thread that has not called Looper.prepare() in CountDownTimer

I have a service. And there is a method called onServiceUpdate(). This method is similiar with onLocationChanged() in Google Maps API. So i want to start CountDownTimer inside onServiceUpdate() method but showing error like this : Can't create…
Leonard Febrianto
  • 964
  • 2
  • 12
  • 37
16
votes
8 answers

How to display the timer in android

I want to display the timer in TextView in the format of like [ 19:59].so when i click the start button ,the timer will display like this for example,i want to set upto 20 mintues,it will display like [19:58][19:87].can anyone give some ideas or…
rajeshlawrance
  • 549
  • 2
  • 6
  • 25
12
votes
4 answers

C# countdown timer

I'm trying to make a countdown using C# and show the time in format: hour:minutes:seconds I've tried this: var minutes = 3; //countdown time var start = DateTime.Now; var end = DateTime.Now.AddMinutes(minutes); Thread.Sleep(1800); if (??)…
The Mask
  • 17,007
  • 37
  • 111
  • 185
12
votes
3 answers

Countdown in date-fns with years, months, days, hours & minutes

I'm using DateFNS and I need to generate a countdown with it. distanceInWordsToNow only outputs in about 3 years but I need the exact time like 3 Years, 11 Months, 20 Days, 3 Hours, 2 Minutes. How to archive that with DateFNS? Here is a CodePen…
Tom
  • 5,588
  • 20
  • 77
  • 129
11
votes
4 answers

Android: Multiple simultaneous count-down timers in a ListView

I am creating an app that requires a ListView with an undetermined number of elements, each of which has a timer that counts down from a variable number. I am able to successfully make one of them count down, but I can't figure out how to include a…
Kevin Cooper
  • 5,018
  • 4
  • 37
  • 51
11
votes
2 answers

Countdown Timer in Angular 6

Hi I am trying to get an example of a countdown timer I found searching on Stack found here: Time CountDown in angular 2 This is my code: import { Component, ElementRef, OnInit, OnDestroy } from '@angular/core'; import { Observable, Subscription,…
user68288
  • 702
  • 2
  • 6
  • 27
11
votes
3 answers

Timer countdown Angular 2

I'm trying to make a countdown timer for my Ionic2 app, the thing is that I was using this method from now countdown timer but now I have to create the countdown like 30:00 min, what's the better way to do it? Time could change, and if I want to…
StuartDTO
  • 783
  • 7
  • 26
  • 72
10
votes
10 answers

How to make a countdown using PHP

Im creating a website for my brothers wedding. And so far all is going well. However, he wants a countdown to the wedding on the homepage; Time left until the wedding: X months, X days, X hours. I would preferebly like to do this using php, but…
RSM
  • 14,540
  • 34
  • 97
  • 144
10
votes
2 answers

hour/minute picker for android countdown timer

I'm trying to implement something like a countdown timer that plays an alarm at 0. I want to be able to set the amount of time to wait before the timer goes off and I'm wondering if there's a UI widget or element that provides this kind of selection…
Dan Quach
  • 101
  • 1
  • 3
10
votes
4 answers

How can I make a countdown from the current date to a specific NSDate?

I want to have a countdown from the current time to a specific date and display that value in a label. I looked at some NSTimer tutorials but I could not figure out how to apply them to my situation. NSTimeInterval TimeInterval = [aString…
user2393702
  • 109
  • 2
  • 8
10
votes
7 answers

What microcontroller (and other components) would I need to create a timer device?

As a hobby project to keep myself out of trouble, I'd like to build a little programmer timer device. It will basically accept a program which is a list of times and then count down from each time. I'd like to use a C or Java micro controller. I…
Bob
  • 97,670
  • 29
  • 122
  • 130
10
votes
3 answers

Android countdown

I want to write a countdown in android which starts counting from 3 to 0. Like at first 3 in appearing and then disappearing and 2 is appearing and so on. I searched a lot but I couldn't find any good sample. Can you help me that what should I do?
Katty
  • 1,707
  • 3
  • 13
  • 18
9
votes
4 answers

Countdown timer 'delays' when tab is inactive?

Trying to build a very simple Javascript countdown. However, whenever the tab is inactive, the countdown begins to lag and holds an incorrect count. See jsfiddle here for example: https://jsfiddle.net/gbx4ftcn/ function initTimer(t) { var self…