Created
April 13, 2015 19:25
-
-
Save minorsecond/96c0d05005887aef54dd to your computer and use it in GitHub Desktop.
Tenths of hours between two times
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_time(time): | |
return datetime.datetime.strptime(time, '%I:%M %p') | |
def total_time(): | |
t_in = get_time(raw_input("Please enter your start time in 00:00 format: ")) | |
t_out = get_time(raw_input("Please enter your end time in 00:00 format: ")) | |
delta = t_out - t_in | |
HOUR = 60 * 60 | |
delta_tenths = float(delta.seconds // (HOUR / 10)) / 10 | |
print("Your time sheet entry for {0} is {1}6").format(delta, delta_tenths) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment