-3

i am sorry for asking question that already answered in other post.

i already have tick method running each second, since i don't know about time format, i only display counter (int variable type) from 1800 (30 minutes) , subtract it one (sec) by each tick , until 0.

can you teach me how to make it to display 30:00, 29:59 .. instead of 1800,1799 until 00:00 ..?

if possible, i don't want to implement any other method to get it done. if you have any idea how to make this possible as simple as possible.. e.g by using time or date type

thank you.

ganero
  • 1
  • 3

1 Answers1

0

You need to use the timedelta() method from the datetime module. You can use it as follows :

import datetime

your_nicely_formated_countdown_value = datetime.timedelta(seconds=your_current_tick_value))

For instance,

import datetime
print(str(datetime.timedelta(seconds=300)))
# => '0:05:00'