Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

If you analyse anything, you destroy it. -- Arthur Miller


devel / comp.lang.python / RE: Subtracting dates to get hours and minutes

SubjectAuthor
o RE: Subtracting dates to get hours and minutes<Gronicus

1
RE: Subtracting dates to get hours and minutes

<mailman.1164.1670989425.20444.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=25087&group=comp.lang.python#25087

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: <Gronicus@SGA.Ninja>
Newsgroups: comp.lang.python
Subject: RE: Subtracting dates to get hours and minutes
Date: Tue, 13 Dec 2022 22:43:35 -0500
Lines: 47
Message-ID: <mailman.1164.1670989425.20444.python-list@python.org>
References: <64B09923-9660-4E02-A5BA-E1F2FC453DAE@barrys-emacs.org>
<Y5Zfk18S0Ji7PAf5@cskk.homeip.net>
<003901d90def$36620a80$a3261f80$@SGA.Ninja>
<da7849f9-1d54-5a82-a616-9683c12ba1c1@marcsnet.com>
<016201d90f6e$3eae74a0$bc0b5de0$@SGA.Ninja>
Mime-Version: 1.0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de gBSX9SPxSnZx4+V5tiWxXgt4Lhmj8CjeX7hrE2uG0wKA==
Return-Path: <Gronicus@SGA.Ninja>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=sga.ninja header.i=@sga.ninja header.b=Iwnuog+I;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.019
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'variable': 0.05;
'datetime': 0.09; 'import': 0.15; 'from:addr:gronicus': 0.16;
'from:addr:sga.ninja': 0.16; 'integer': 0.16; 'message-
id:@SGA.Ninja': 0.16; 'received:floathosting.com': 0.16;
'received:mars.floathosting.com': 0.16; 'subject:hours': 0.16;
'uncomment': 0.16; 'to:addr:python-list': 0.20; 'this?': 0.29;
'comment': 0.31; '13,': 0.32; 'header:In-Reply-To:1': 0.34; 'fix':
0.36; 'hard': 0.37; 'hours': 0.63; 'required': 0.65; 'resulting':
0.70; 'subject:get': 0.70; 'coded': 0.84
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sga.ninja;
s=default;
h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:
Date:Subject:In-Reply-To:References:To:From:Sender:Reply-To:Cc:Content-ID:
Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=mgekaBxNRiDc+rOyfZGRI82jMABJM96AjMFUSoHlSKw=; b=Iwnuog+IPNVt1HknTxayUC7Y3Y
sOZKPCk1semjY6NfjUGZCaIoKaDW92xuJl6uTc2MkP7OvToPcb7UbBN30wHs0XCcYpFk8KErNFcDK
QDQQ6uWKBqfXxSVJBbuF/jbmMbzHqUjbZzzpR5j5U8AdDmCYOGHTIceMU9SeachRODByoestK8KyK
I7PhbaC6FW/j3ZfbNZKNA+xlRsJ5D6AL4aFvVde45ys/mDHuS0OPox0S4IDTz80GIosqaNyQ4s0JI
FeLpadOGhCC50s9icnfniO5S8d2jAbQV4zE0Y2HGXNV92gCbp/Ga7WkWjPD9uzI7AYn2RvFW8uScL
qTC4NOMA==;
In-Reply-To: <da7849f9-1d54-5a82-a616-9683c12ba1c1@marcsnet.com>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQEI4wLQAUFFAWuydlBjZcwsuuyEZAHDF8ALAgQKrzYCj9b2kq/aXbfg
X-AntiAbuse: This header was added to track abuse,
please include it with any abuse report
X-AntiAbuse: Primary Hostname - mars.floathosting.com
X-AntiAbuse: Original Domain - python.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - SGA.Ninja
X-Get-Message-Sender-Via: mars.floathosting.com: authenticated_id:
gronicus@sga.ninja
X-Authenticated-Sender: mars.floathosting.com: gronicus@sga.ninja
X-Source:
X-Source-Args:
X-Source-Dir:
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <016201d90f6e$3eae74a0$bc0b5de0$@SGA.Ninja>
X-Mailman-Original-References: <64B09923-9660-4E02-A5BA-E1F2FC453DAE@barrys-emacs.org>
<Y5Zfk18S0Ji7PAf5@cskk.homeip.net>
<003901d90def$36620a80$a3261f80$@SGA.Ninja>
<da7849f9-1d54-5a82-a616-9683c12ba1c1@marcsnet.com>
 by: <Gronicus@SGA.Ninja> - Wed, 14 Dec 2022 03:43 UTC

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?

#-----------------------------------------------------------------------------
import datetime
#================================================# Test A Hard coded Date/Time
Startt = datetime.datetime(2022, 12, 13, 5, 3, 30)
Stopp = datetime.datetime(2022, 12, 12, 21, 15, 30)

# ================================================# Test B Date/Time data as a variable
#Startt = (2022, 12, 13, 5, 3, 30)
#Stopp = (2022, 12, 12, 21, 15, 30)

#Startt = datetime.datetime(Startt)
#Stopp = datetime.datetime(Stopp)

# ================================================c = Startt - Stopp
minutes = c.total_seconds() / 60
minutes = c.seconds / 60
hours = 0

while (minutes > 59):
minutes = minutes - 60
hours += 1
minutes = round(minutes)
print()
print (" Hours = <" + str(hours) + ">")
print (" Minutes = <" + str(minutes) + ">")

# -----------------------------------------------------------------------------


devel / comp.lang.python / RE: Subtracting dates to get hours and minutes

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor