1

I want to get the current time of day in minutes. I found this code online:

import datetime start = datetime.datetime(2009, 1, 31) end = datetime.datetime(2009, 2, 1) diff = end-start print (diff.days * 1440) + (diff.seconds / 60) >> 1440.0 

I'm not sure how i can do this using the datetime.now() function, and get the current time of day.

I can compare times if i set the datetime.now() to a variable, and later set it to another variable, and compare them.

1

1 Answer 1

6

I guess this is what you're looking for.

import datetime now = datetime.datetime.now() print(now.hour*60 + now.minute) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.