Skip to content

Instantly share code, notes, and snippets.

@minorsecond
Created April 13, 2015 19:25
Show Gist options
  • Save minorsecond/96c0d05005887aef54dd to your computer and use it in GitHub Desktop.
Save minorsecond/96c0d05005887aef54dd to your computer and use it in GitHub Desktop.
Tenths of hours between two times
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