Skip site navigation (1) Skip section navigation (2)

Re: Inconsistent results when calculating "age" of db records

From: Ghislain LEVEQUE <ghislain(dot)leveque(at)clarisys(dot)fr>
To: psycopg(at)postgresql(dot)org
Subject: Re: Inconsistent results when calculating "age" of db records
Date: 2012-07-26 07:08:36
Message-ID: 5010ECF4.6090506@clarisys.fr (view raw or flat)
Thread:
Lists: psycopg
Le 26/07/2012 08:11, Raheem Sarcar a écrit :

> I get the following output -->
> 11:24:47.082  (which is correct)
>  [...]
>  From which I get the following result -->
> datetime.timedelta(-1, 45312, 918000).
>
>
> I then apply the formula "t.seconds/3600" and get the result "12" hrs (which is incorrect).

Did you forget do take into account the days member of your timedelta ?

-1 day + 12 hours = 12 hours


-- 
Ghislain LEVEQUE - Clarisys Informatique
http://www.clarisys.fr - 09 72 11 43 60


In response to

Responses

psycopg by date

Next:From: Daniele VarrazzoDate: 2012-07-26 09:31:34
Subject: Re: Inconsistent results when calculating "age" of db records
Previous:From: Raheem SarcarDate: 2012-07-26 06:11:33
Subject: Inconsistent results when calculating "age" of db records

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group