Answers for "list comprehensions with dates"

0

list comprehensions with dates

from datetime import datetime, timedelta
today = datetime.utcnow().date()
ct = datetime(today.year, today.month, today.day) # current_timestamp
time_intervals = []
while ct.hour <= 23 and today.day == ct.day:
  ct = ct + timedelta(minutes=10)
  time_intervals.append('%02d:%02d' % (ct.hour, ct.minute))
sorted_time_intervals = (sorted(time_intervals))
Posted by: Guest on August-04-2020

Code answers related to "list comprehensions with dates"

Python Answers by Framework

Browse Popular Code Answers by Language