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
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
+ ">")
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
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
, 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
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
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")
# =
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
<" + str(hours) + ">")
print ("78 Minutes = <" + str(minutes) + ">")
if hours > 7:
print(" Time to inject Humulin R u500.")
pause = input("Pause")
# ==
---
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
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
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
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?
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
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
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
16 matches
Mail list logo