Python Forum
Reset counter when the day turns over
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reset counter when the day turns over
#1
I want to monitor an event's and store value in counter and when the day turns over, it resets the counter to zero.

Here is a example
Day: 28 Count: 0
Day: 28 Count: 1
Day: 28 Count: 2
... .....
Day: 28 Count: 123

Day: 29 Count: 0
Day: 29 Count: 1
Day: 29 Count: 2
Day: 29 Count: 3
... ... ...
Day: 29 Count: 565

Day: 30 Count: 0
Day: 26 Count: 1

Day 28 have 123 entries because the next day 29 started after the 28 turned over.

Day 29 have 565 entries because the next day 30 started after the 29 turned over.

any idea how to make script

import time
import datetime
count = 0 
now = datetime.datetime.now()
Reply


Messages In This Thread
Reset counter when the day turns over - by Rehan11 - Dec-28-2018, 03:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create a sequential number (counter) and reset at each duplicate Mekala 0 1,784 Sep-20-2020, 05:02 AM
Last Post: Mekala
  Beginner Code, how to print something after a number of turns (guessing game) QTPi 4 2,919 Jun-18-2020, 04:59 PM
Last Post: QTPi

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020