From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: subtract two dates to get the number of days
Date: Wed, 14 Jul 2010 18:06:22 +0200
Message-ID: <i1kn9t$9e5$1@dough.gmane.org> (raw)
In-Reply-To: <4C3DAF72.6030606@verizon.net>
References: <B10E6810AC2A2F4EA7550D072CDE876004B2E65D@SAB-FENWICK.sab.uiuc.edu>
<4C3DAF72.6030606@verizon.net>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: subtract two dates to get the number of days
In-Reply-To: <i1kn9t$9e5$1@dough.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox