RE: [SQL] datediff function - Mailing list pgsql-sql

From Pham, Thinh
Subject RE: [SQL] datediff function
Date
Msg-id 551413BBBB03D111BF880060B01AACCE139F35@home.priority.net
Whole thread Raw
Responses RE: [SQL] datediff function  (Herouth Maoz <herouth@oumail.openu.ac.il>)
List pgsql-sql
Thank you for answering all my stupid questions. I did read the User manual
as well as Programmer and Admin, and what i was able to get out was not
much. I guess i wasn't used to the way that postgres work coming from a
microsoft background. But wouldn't you agree that the manuals was a little
brief and criptic at times? My question is how do i go about writing some
more documentations and examples and submit it for inclusion into the
manual. It just so that the next person w/ the same background as i would be
able to understand those functions quickly and be able to use the example
and apply it to his program w/o asking all those same basic questions which
i'm sure you guys are tired of answering.

Also, is it the same thing for submitting documentation as well as function
into postgres? What i really need was the total amount of time between 2
separate point of times. If i ask for 'day' then it return day, 'minute'
then it return minutes. For example:

Timein                Timeout
Tue Aug 17 15:00:00 1999 CDT    Tue Aug 17 16:00:00 1999 CDT

select datediff(day, timein, timeout) as totaltime from schedule

Would give me a _number_ 0 since it's the same day, and if i used minute as
below:


select datediff(minute, timein, timeout) as totaltime from schedule

It would give me the number 60, that's it. I don't want any qualifier behind
the number since it blew up the stupid microsoft ADO driver like you
wouldn't believe.

Thank you,
Thinh


> -----Original Message-----
> From: Herouth Maoz [mailto:herouth@oumail.openu.ac.il]
> Sent: Tuesday, August 17, 1999 8:29 AM
> To: Pham, Thinh; 'pgsql-sql@postgreSQL.org'
> Subject: RE: [SQL] datediff function
> 
> 
> At 16:18 +0300 on 17/08/1999, Pham, Thinh wrote:
> 
> 
> > What happen if i just want to compare using minute only or 
> hour only instead
> > of day? Is there a function to do that or is postgres only 
> work in day?
> 
> No problem, just write 'now'::datetime - '6 hours'::timespan. 
> Or some such.
> Please read about the datetime and timespan types in the user guide.
> 
> Herouth
> 
> --
> Herouth Maoz, Internet developer.
> Open University of Israel - Telem project
> http://telem.openu.ac.il/~herutma
> 
> 
> 


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] datediff function
Next
From: Herouth Maoz
Date:
Subject: RE: [SQL] datediff function