## How to format 1800 seconds to MM:SS format

I have the following Kotlin code for simple countdown timer:

```val thousand: Long = 1000

val timer = object: CountDownTimer(1800000, 1000) {

override fun onTick(millisUntilFinished: Long) {
var timeResult = millisUntilFinished/thousand
textTimer.text = "\$timeResult"
}
override fun onFinish() {
textTimer.text = "Time is out"
}
}
timer.start()
textTimer.text = "\$timer"
```

How to format `1800 seconds` to `30 min : 00 sec` in Kotlin?

You get the numbers by integer division and modulo (`%`) and the formatting to 2 digits with `padStart()`:

```val secs = 1800
val formatted = "\${(secs / 60).toString().padStart(2, '0')} min : \${(secs % 60).toString().padStart(2, '0')} sec"
println(formatted)
```

will print

```30 min : 00 sec
```

android - How to format 1800 seconds to MM:SS format, I have the following Kotlin code for simple countdown timer: val thousand: Long = 1000 val timer = object: CountDownTimer(1800000, 1000) { override fun  I have data in seconds on which i have to do AVG and show in MM:SS format. I used below formula to create a calculated field . 1) Formula : Seconds is the column which has data in seconds. IIF([Seconds] % 60 == 60,0,[Seconds] % 60) + INT([Seconds]/60) * 100

Convert Total Seconds'to hh:mm:ss, How can an integer (# of seconds) be converted into hh:mm:ss format? the integer field TotalSeconds to display Hours, minutes, & seconds. How to Convert Seconds to HH:MM:SS format in Report Studio. Troubleshooting. Problem. How to change an integer (seconds) to HH:MM:SS format in Report Studio.

Here's how my code looks like at the moment:

```val timer = object: CountDownTimer(1800000, 1000) {

override fun onTick(millisUntilFinished: Long) {

val timeResult =
"\${(millisUntilFinished / 1000 / 60).toString().padStart(2, '0')}:" +
"\${(millisUntilFinished / 1000 % 60).toString().padStart(2, '0')} "

textTimer.text = "\$timeResult"
}
override fun onFinish() {
textTimer.text = "Time is out"
}
}
timer.start()
textTimer.text = "\$timer"
```

How to Convert Seconds to HH:MM:SS format in Report Studio, How to change an integer (seconds) to HH:MM:SS format in Report Studio. Convert hh:mm:ss time format to seconds / minutes / hours with Kutools for Excel. On the contrary of above problem, if you want to convert hh:mm:ss time format to seconds, minutes or hours, I can recommend a useful tool-Kutools for Excel, with its Convert Time feature, you can quickly convert the time format to the number of hours, minutes or seconds.

Following code can convert from milliseconds (which is what you have initially) to minutes and seconds:

```val milliseconds: Long = 1800000

val minutes = milliseconds / 1000 / 60
val seconds = milliseconds / 1000 % 60

println("\$minutes min : \$seconds sec")
```

Output:

`30 min : 0 sec`

EDIT 1:

If you strictly need it from seconds to minutes and seconds, just remove the extra division by 1000.

The code for that will be:

```val seconds: Long = 1800

val minutes = milliseconds / 60
val seconds = milliseconds % 60

println("\$minutes min : \$seconds sec")
```

The code in the original question had milliseconds in it that's why I mentioned it from Milliseconds.

EDIT 2:

Missed out the double digit formatting.

The answer by @forpas using `.toString().padStart(2, '0')` will give the correct formatted output. So, the correct code would be:

```val milliseconds: Long = 1800000

val minutes = milliseconds / 1000 / 60
val seconds = milliseconds / 1000 % 60

```

Output:

`30 min : 00 sec`

Automic Script to convert seconds to HH:MM:SS format, to convert seconds to HH:MM:SS format In version 8 was the result for div(​1800  Hi All, I am new here. I have a small Excel (2010) job where I need to format the secondary vAxis and define the min. and max. value (I try to add a screen shot). So let me explain. Currently and based on the data given the Axis shows a range from 5:46 to 7:03. But I want the line graph to display t

Formulas for converting seconds into hours and minutes in the , to convert seconds to HH:MM:SS format In version 8 was the result for div(​1800  RE: Convert Seconds To HH:MM:SS mp9 (Programmer) 20 Jul 05 11:20 If your EndTime field is just a number, here's one way to mask it like a time - note that it's still just a number but it gives the right format if you want to use it in queries, reports, code, etc.

Convert seconds to minute.second format. - Answers, Formulas for converting seconds into hours and minutes in the following format hh:mm:ss. I want to convert OmniChannel : Agent Work fields  Hi, im coding a UHC plugin that uses a timer on Bossbar, so i have the timer working correctly but idk how to chage the format 600 seconds to 10:00 minutes, can you help me, this is my code:

Convert Seconds to HH:MM:SS format, I have a number field that is showing seconds and I want to convert that to a mm.​ss format keeping it a number format(I know it can be done  I have used the dax formula to convert seconds to hh:mm:ss successfully. When used in a matrix it either gives me the earliest or latest option as displayed in the attached example. What can I do to display the summarised seconds in hh:mm:ss. Currently the converted dax data is in text form. Thank you in advance