Re: subtract two dates to get the number of days - Mailing list pgsql-sql

From Thomas Kellerer
Subject Re: subtract two dates to get the number of days
Date
Msg-id i1kn9t$9e5$1@dough.gmane.org
Whole thread Raw
In response to Re: subtract two dates to get the number of days  (Jean-David Beyer <jeandavid8@verizon.net>)
Responses Re: subtract two dates to get the number of days  (Jean-David Beyer <jeandavid8@verizon.net>)
List pgsql-sql
Jean-David Beyer wrote on 14.07.2010 14:37:
> My dates are of the form yyyy-mm-dd and such.
Storing a date as a string is never a good idea.

> And I want to do things like adding or subtracting days, months, or years to it or from it.
>Also the logical comparisons.
Which is all a piece of cake when you use the proper datatype 
> Years ago, I made a C++ data type that allowed a date datatype where I
> could add, subtract, and so on.
> I use it in programs that do not necessarily use a database,
To be honest: I expect the programming language to support those things.

> but also in programs that do when the computations are the big part of the cpu load,
> as contrasted to just "gentle" massaging of existing data.
I would expect doing "date maths" with strings is wasting more CPU than using a native date datatype.

Just my €0.02
Thomas



pgsql-sql by date:

Previous
From: Reinoud van Leeuwen
Date:
Subject: Re: Question on COUNT performance
Next
From: Lee Hachadoorian
Date:
Subject: Re: Question on COUNT performance