Jean-David Beyer, 14.07.2010 19:05:
I just looked them up in my data definitions. Dates are _stored_ as type
DATE NOT NULL
Very good ;)
Yes, if the data happen to be stored at all. But when a program
generates the dates dynamically and wants to produce queries from them,
it is easier to use
Thomas Kellerer wrote:
> Jean-David Beyer wrote on 14.07.2010 14:37:
>> My dates are of the form -mm-dd and such.
> Storing a date as a string is never a good idea.
I started this long ago, when postgreSQL did not really work very well
(1998?). One version of it would not do views, and another
Jean-David Beyer wrote on 14.07.2010 14:37:
My dates are of the form -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 wh
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Campbell, Lance wrote:
> I want to subtract to dates to know the number of days different.
>
>
>
> Example:
>
> 01/02/2010 - 01/01/2010 = 1 day
>
> 08/01/2010 - 07/31/2010 = 1 day
>
>
>
> How do I do this?
>
Others have posted SQL answers to t
On 07/13/10 18:58, Campbell, Lance wrote:
I want to subtract to dates to know the number of days different.
it would be far more interesting operation if u want to divide an
INTERVAL by INTERVAL to get a ratio :-)
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes
Campbell, Lance, 13.07.2010 16:58:
I want to subtract to dates to know the number of days different.
Example:
01/02/2010 - 01/01/2010 = 1 day
08/01/2010 - 07/31/2010 = 1 day
How do I do this?
SELECT DATE '2010-02-01' - DATE '2010-01-01';
SELECT DATE '2010-08-01' - DATE '2010-07-31';
"Campbell, Lance" writes:
> I want to subtract to dates to know the number of days different.
> Example:
> 01/02/2010 - 01/01/2010 = 1 day
> 08/01/2010 - 07/31/2010 = 1 day
> How do I do this?
If they're dates, you just subtract.
regression=# select '08/01/2010'::date - '07/31/2010'::date;
?co
I want to subtract to dates to know the number of days different.
Example:
01/02/2010 - 01/01/2010 = 1 day
08/01/2010 - 07/31/2010 = 1 day
How do I do this?
Thanks,
Lance Campbell
Software Architect/DBA/Project Manager
Web Services at Public Affairs
217-333-0382