From: | Raheem Sarcar <raheemm1(at)yahoo(dot)com> |
---|---|
To: | Raheem Sarcar <raheemm1(at)yahoo(dot)com>, "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org> |
Subject: | Re: Inconsistent results when calculating "age" of db records |
Date: | 2012-07-26 10:15:32 |
Message-ID: | 1343297732.72020.YahooMailNeo@web163903.mail.gq1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
Never mind all. It was a mistake in my conversion from timedelta to hours:mins format. Thanks for your help :)
- Raheem M. Sarcar
----- Original Message -----
From: Raheem Sarcar <raheemm1(at)yahoo(dot)com>
To: "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org>
Cc:
Sent: Thursday, July 26, 2012 4:02 PM
Subject: Re: [psycopg] Inconsistent results when calculating "age" of db records
Ghislain,
Im ignoring the -1. I assumed that for times when the timedelta is less than 1 day, that item is ignored. But maybe now? Would you mind elaborating on how to get find the hours ago a record was created from something like ( -1, 30319, 123000 )?
Thanks
- Raheem M. Sarcar
----- Original Message -----
From: Ghislain LEVEQUE <ghislain(dot)leveque(at)clarisys(dot)fr>
To: psycopg(at)postgresql(dot)org
Cc:
Sent: Thursday, July 26, 2012 1:08 PM
Subject: Re: [psycopg] Inconsistent results when calculating "age" of db records
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
--
Sent via psycopg mailing list (psycopg(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/psycopg
From | Date | Subject | |
---|---|---|---|
Next Message | Alan Etkin | 2012-07-26 22:21:57 | error after installing on CentOS 5.8 with source |
Previous Message | Raheem Sarcar | 2012-07-26 10:02:46 | Re: Inconsistent results when calculating "age" of db records |