Re: subtract two dates to get the number of days
От | Jean-David Beyer |
---|---|
Тема | Re: subtract two dates to get the number of days |
Дата | |
Msg-id | 4C3DAF72.6030606@verizon.net обсуждение исходный текст |
Ответ на | subtract two dates to get the number of days ("Campbell, Lance" <lance@illinois.edu>) |
Ответы |
Re: subtract two dates to get the number of days
|
Список | pgsql-sql |
-----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 this. Which is fine if you need to do it in SQL. My dates are of the form yyyy-mm-dd and such. And I want to do things like adding or subtracting days, months, or years to it or from it. Also the logical comparisons. 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, 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. - -- .~. Jean-David Beyer Registered Linux User 85642. /V\ PGP-Key: 9A2FC99A Registered Machine 241939./()\ Shrewsbury, New Jersey http://counter.li.org^^-^^ 08:20:01 up 6 days, 17:06, 4 users, load average: 4.77,4.78, 4.87 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with CentOS - http://enigmail.mozdev.org/ iD8DBQFMPa9yPtu2XpovyZoRAnuDAJ9U9yghDl8NkGNv1pWSxIwXsDBTXwCgiv1L INK1dzbUQnWBjhXXrQu6ZsM= =lyR9 -----END PGP SIGNATURE-----
В списке pgsql-sql по дате отправления: