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

time difference

From: "Seema Noor" <seema_56(at)yahoo(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: time difference
Date: 2001-05-25 15:12:16
Message-ID: 004601c0e52d$1af00340$0100a8c0@noor (view raw, whole thread or download thread mbox)
Lists: pgsql-novicepgsql-sql
i want to calculate the session time. my query is this

select now() - '2001-05-19 12:09:00+5;

it gives the difference in date and difference in time separately. if the
current time is greater than the second time then it gives simply their
difference but i want to calcutate the session time from these two times.
if now() = 2001-05-25 01:00:00+5
and second timestamp = 2001-05-24 23:00:00+5

then how can i get their time differernce EQUAL TO '3:00:00' instead of '21:00:00 ago' ?

and is there a way to get the total time difference including the date factor involved i.e.
if now() = 2001-05-25 23:00:00+5
and second timestamp = 2001-05-24 01:00:00+5
then is there any function to get their difference equal to '46:00:00' instead of '1 22:00:00' ?

please reply me soon.

pgsql-novice by date

Next:From: MilenDate: 2001-05-25 17:40:51
Subject: batch file
Previous:From: Tatsuo IshiiDate: 2001-05-25 01:02:51
Subject: Re: Charset and encoding

pgsql-sql by date

Next:From: Peter EisentrautDate: 2001-05-25 15:34:15
Subject: Re: Large Objects Documentation
Previous:From: Roberto MelloDate: 2001-05-25 14:49:03
Subject: Large Objects Documentation

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