Re: Subtracting dates to get hours and minutes

2022-12-15 Thread Thomas Passin
On 12/15/2022 11:34 PM, MRAB wrote: On 2022-12-15 22:49, Gronicus@SGA.Ninja wrote: Yes, it works like a charm. On the tupility of it all. Special thanks for the explanation too….. (Originally asked but I found the errors. All is working) Now that the code no longer produces the errors, I see

Re: Subtracting dates to get hours and minutes

2022-12-15 Thread MRAB
On 2022-12-15 22:49, Gronicus@SGA.Ninja wrote: Yes, it works like a charm. On the tupility of it all. Special thanks for the explanation too….. (Originally asked but I found the errors. All is working) Now that the code no longer produces the errors, I see that the year and month not

Re: Subtracting dates to get hours and minutes

2022-12-15 Thread Thomas Passin
+ ">") if hours > 7:      print(" Time to inject Humulin R u500.") pause = input("Pause") # == -Original Message- From: Python-list On Behalf Of Thomas Passin Sent: Tuesday, December 13, 2022 1

RE: Subtracting dates to get hours and minutes

2022-12-15 Thread Gronicus
this? From: anthony.flury Sent: Thursday, December 15, 2022 1:47 PM To: Gronicus@SGA.Ninja Subject: RE: Subtracting dates to get hours and minutes What is likely happening is that when you read the data from the file you are not reading a tuple, you are reading a 26 charcter string. You have

Re: Subtracting dates to get hours and minutes

2022-12-15 Thread Weatherby,Gerard
, December 15, 2022 at 5:02 PM To: 'anthony.flury' , python-list@python.org Subject: RE: Subtracting dates to get hours and minutes *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** Yes, it works like a charm. On the tupility of it all

RE: Subtracting dates to get hours and minutes

2022-12-15 Thread Gronicus
PM To: Gronicus@SGA.Ninja Subject: RE: Subtracting dates to get hours and minutes What is likely happening is that when you read the data from the file you are not reading a tuple, you are reading a 26 charcter string. You have to convert that string into a tuple - the easiest way

Re: Subtracting dates to get hours and minutes

2022-12-15 Thread Thomas Passin
nutes = minutes - 60 hours += 1 minutes = round(minutes) print ("77 Hours = <" + str(hours) + ">") print ("78 Minutes = <" + str(minutes) + ">") if hours > 7: print(" Time to inject Humulin R u500.") pause = input("Pause") # =

Re: Subtracting dates to get hours and minutes

2022-12-15 Thread MRAB
hours = 0 while (minutes > 59): minutes = minutes - 60 hours += 1 minutes = round(minutes) print ("77 Hours = <" + str(hours) + ">") print ("78 Minutes = <" + str(minutes) + ">") if hours > 7: print(" Ti

RE: Subtracting dates to get hours and minutes

2022-12-15 Thread Gronicus
<" + str(hours) + ">") print ("78 Minutes = <" + str(minutes) + ">") if hours > 7: print(" Time to inject Humulin R u500.") pause = input("Pause") # == ---

Re: Subtracting dates to get hours and minutes

2022-12-14 Thread Thomas Passin
ember 13, 2022 11:20 PM To: python-list@python.org Subject: Re: Subtracting dates to get hours and minutes Your problem is that datetime.datetime does not accept a tuple as an argument. It expects an integer value for the first argument, but you supplied a tuple. In Python, you can use a sequence

RE: Subtracting dates to get hours and minutes

2022-12-13 Thread Gronicus
assin Sent: Tuesday, December 13, 2022 11:20 PM To: python-list@python.org Subject: Re: Subtracting dates to get hours and minutes Your problem is that datetime.datetime does not accept a tuple as an argument. It expects an integer value for the first argument, but you supplied a tuple. In Python, y

Re: Subtracting dates to get hours and minutes

2022-12-13 Thread Thomas Passin
Your problem is that datetime.datetime does not accept a tuple as an argument. It expects an integer value for the first argument, but you supplied a tuple. In Python, you can use a sequence (e.g., tuple or list) the way you want by prefixing it with an asterisk. This causes the sequence of

RE: Subtracting dates to get hours and minutes

2022-12-13 Thread Gronicus
As is, Test A works. Comment out Test A and uncomment Test B it fails. In Test B, I move the data into a variable resulting with the report: "TypeError: an integer is required (got type tuple) How do I fix this?

Re: Subtracting dates to get hours and minutes

2022-12-12 Thread Weatherby,Gerard
on behalf of Marc Lucke Date: Monday, December 12, 2022 at 11:37 AM To: python-list@python.org Subject: Re: Subtracting dates to get hours and minutes *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. *** my approach would be to convert your

Re: Subtracting dates to get hours and minutes

2022-12-12 Thread Marc Lucke
my approach would be to convert your two date/times to seconds from epoch - e.g. https://www.geeksforgeeks.org/convert-python-datetime-to-epoch/ - then subtract the number, divide the resultant by 3600 (hours) & get the modulus for minutes.  There's probably a standard function - it should be

RE: Subtracting dates to get hours and minutes

2022-12-12 Thread Mike Dewhirst
I have seen vast conversations on this topic but if everything is in the same time-zone and daylight saving switchovers are not involved it is relatively straightforward.Check the timedelta docs. Or convert datetimes to ordinals and subtract then convert the result to whatever units please