pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feeddatediff is there something like it?
5+ messages / 4 participants
[nested] [flat]
* datediff is there something like it?
@ 2005-01-25 15:11 Joel Fradkin <jfradkin@wazagua.com>
0 siblings, 2 replies; 5+ messages in thread
From: Joel Fradkin @ 2005-01-25 15:11 UTC (permalink / raw)
To: pgsql-sql
Hi all working my way through our views and all is going very well.
We use datediff in MSSQL a bit and I read about the field1::date -
field2::date to return the days numerically.
Is there any way to get months and years besides guessing days / 30 for
months etc?
Joel Fradkin
Wazagua, Inc.
2520 Trailmate Dr
Sarasota, Florida 34243
Tel. 941-753-7111 ext 305
jfradkin@wazagua.com
www.wazagua.com
Powered by Wazagua
Providing you with the latest Web-based technology & advanced tools.
C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
This email message is for the use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and delete and destroy
all copies of the original message, including attachments.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: datediff is there something like it?
@ 2005-01-25 16:33 Achilleus Mantzios <achill@matrix.gatewaynet.com>
parent: Joel Fradkin <jfradkin@wazagua.com>
1 sibling, 1 reply; 5+ messages in thread
From: Achilleus Mantzios @ 2005-01-25 16:33 UTC (permalink / raw)
To: Joel Fradkin <jfradkin@wazagua.com>; +Cc: pgsql-sql
O Joel Fradkin Ýãñáøå óôéò Jan 25, 2005 :
> Hi all working my way through our views and all is going very well.
>
> We use datediff in MSSQL a bit and I read about the field1::date -
> field2::date to return the days numerically.
>
> Is there any way to get months and years besides guessing days / 30 for
> months etc?
Go to
http://www.postgresql.org/docs/7.4/interactive/functions-datetime.html
Check out smth like...
SELECT 'Achilleus is ' || date_part('years',age(timestamp '1969-01-31'))
|| ' years and ' || date_part('months',age(timestamp '1969-01-31')) || '
months old';
?column?
-----------------------------------------
Achilleus is 35 years and 11 months old
(1 row)
>
>
>
> Joel Fradkin
>
>
>
> Wazagua, Inc.
> 2520 Trailmate Dr
> Sarasota, Florida 34243
> Tel. 941-753-7111 ext 305
>
>
>
> jfradkin@wazagua.com
> www.wazagua.com
> Powered by Wazagua
> Providing you with the latest Web-based technology & advanced tools.
> C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
> This email message is for the use of the intended recipient(s) and may
> contain confidential and privileged information. Any unauthorized review,
> use, disclosure or distribution is prohibited. If you are not the intended
> recipient, please contact the sender by reply email and delete and destroy
> all copies of the original message, including attachments.
>
>
>
>
>
>
>
>
>
--
-Achilleus
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: datediff is there something like it?
@ 2005-01-25 17:54 Joel Fradkin <jfradkin@wazagua.com>
parent: Achilleus Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 1 reply; 5+ messages in thread
From: Joel Fradkin @ 2005-01-25 17:54 UTC (permalink / raw)
To: 'Achilleus Mantzios' <achill@matrix.gatewaynet.com>; +Cc: pgsql-sql
Yes I am using datepart, but not seeing how with a datediff.
Maybe I just need to do the date math and put a date part on the result.
I will play around a bit when I hit one not looking for days.
Joel Fradkin
Wazagua, Inc.
2520 Trailmate Dr
Sarasota, Florida 34243
Tel. 941-753-7111 ext 305
jfradkin@wazagua.com
www.wazagua.com
Powered by Wazagua
Providing you with the latest Web-based technology & advanced tools.
© 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
This email message is for the use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and delete and destroy
all copies of the original message, including attachments.
-----Original Message-----
From: Achilleus Mantzios [mailto:achill@matrix.gatewaynet.com]
Sent: Tuesday, January 25, 2005 11:34 AM
To: Joel Fradkin
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] datediff is there something like it?
O Joel Fradkin Ýãñáøå óôéò Jan 25, 2005 :
> Hi all working my way through our views and all is going very well.
>
> We use datediff in MSSQL a bit and I read about the field1::date -
> field2::date to return the days numerically.
>
> Is there any way to get months and years besides guessing days / 30 for
> months etc?
Go to
http://www.postgresql.org/docs/7.4/interactive/functions-datetime.html
Check out smth like...
SELECT 'Achilleus is ' || date_part('years',age(timestamp '1969-01-31'))
|| ' years and ' || date_part('months',age(timestamp '1969-01-31')) || '
months old';
?column?
-----------------------------------------
Achilleus is 35 years and 11 months old
(1 row)
>
>
>
> Joel Fradkin
>
>
>
> Wazagua, Inc.
> 2520 Trailmate Dr
> Sarasota, Florida 34243
> Tel. 941-753-7111 ext 305
>
>
>
> jfradkin@wazagua.com
> www.wazagua.com
> Powered by Wazagua
> Providing you with the latest Web-based technology & advanced tools.
> C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
> This email message is for the use of the intended recipient(s) and may
> contain confidential and privileged information. Any unauthorized review,
> use, disclosure or distribution is prohibited. If you are not the
intended
> recipient, please contact the sender by reply email and delete and destroy
> all copies of the original message, including attachments.
>
>
>
>
>
>
>
>
>
--
-Achilleus
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: datediff is there something like it?
@ 2005-01-25 19:03 Oleg Bartunov <oleg@sai.msu.su>
parent: Joel Fradkin <jfradkin@wazagua.com>
0 siblings, 0 replies; 5+ messages in thread
From: Oleg Bartunov @ 2005-01-25 19:03 UTC (permalink / raw)
To: Joel Fradkin <jfradkin@wazagua.com>; +Cc: 'Achilleus Mantzios' <achill@matrix.gatewaynet.com>; pgsql-sql
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
---559023410-912437380-1106679801=:6363
Content-Type: TEXT/PLAIN; charset=koi8-r; format=flowed
Content-Transfer-Encoding: 8BIT
On Tue, 25 Jan 2005, Joel Fradkin wrote:
> Yes I am using datepart, but not seeing how with a datediff.
> Maybe I just need to do the date math and put a date part on the result.
> I will play around a bit when I hit one not looking for days.
>
http://www.pgsql.ru/db/pgsearch/index.html?q=datediff
> Joel Fradkin
>
> Wazagua, Inc.
> 2520 Trailmate Dr
> Sarasota, Florida 34243
> Tel. 941-753-7111 ext 305
>
> jfradkin@wazagua.com
> www.wazagua.com
> Powered by Wazagua
> Providing you with the latest Web-based technology & advanced tools.
> © 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
> This email message is for the use of the intended recipient(s) and may
> contain confidential and privileged information. Any unauthorized review,
> use, disclosure or distribution is prohibited. If you are not the intended
> recipient, please contact the sender by reply email and delete and destroy
> all copies of the original message, including attachments.
>
>
>
>
> -----Original Message-----
> From: Achilleus Mantzios [mailto:achill@matrix.gatewaynet.com]
> Sent: Tuesday, January 25, 2005 11:34 AM
> To: Joel Fradkin
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] datediff is there something like it?
>
> O Joel Fradkin ?????? ???? Jan 25, 2005 :
>
>> Hi all working my way through our views and all is going very well.
>>
>> We use datediff in MSSQL a bit and I read about the field1::date -
>> field2::date to return the days numerically.
>>
>> Is there any way to get months and years besides guessing days / 30 for
>> months etc?
>
> Go to
> http://www.postgresql.org/docs/7.4/interactive/functions-datetime.html
> Check out smth like...
>
> SELECT 'Achilleus is ' || date_part('years',age(timestamp '1969-01-31'))
> || ' years and ' || date_part('months',age(timestamp '1969-01-31')) || '
> months old';
> ?column?
> -----------------------------------------
> Achilleus is 35 years and 11 months old
> (1 row)
>
>
>
>>
>>
>>
>> Joel Fradkin
>>
>>
>>
>> Wazagua, Inc.
>> 2520 Trailmate Dr
>> Sarasota, Florida 34243
>> Tel. 941-753-7111 ext 305
>>
>>
>>
>> jfradkin@wazagua.com
>> www.wazagua.com
>> Powered by Wazagua
>> Providing you with the latest Web-based technology & advanced tools.
>> C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
>> This email message is for the use of the intended recipient(s) and may
>> contain confidential and privileged information. Any unauthorized review,
>> use, disclosure or distribution is prohibited. If you are not the
> intended
>> recipient, please contact the sender by reply email and delete and destroy
>> all copies of the original message, including attachments.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
---559023410-912437380-1106679801=:6363--
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: datediff is there something like it?
@ 2005-01-26 20:13 Bruno Wolff III <bruno@wolff.to>
parent: Joel Fradkin <jfradkin@wazagua.com>
1 sibling, 0 replies; 5+ messages in thread
From: Bruno Wolff III @ 2005-01-26 20:13 UTC (permalink / raw)
To: Joel Fradkin <jfradkin@wazagua.com>; +Cc: pgsql-sql
On Tue, Jan 25, 2005 at 10:11:40 -0500,
Joel Fradkin <jfradkin@wazagua.com> wrote:
> Hi all working my way through our views and all is going very well.
>
> We use datediff in MSSQL a bit and I read about the field1::date -
> field2::date to return the days numerically.
>
> Is there any way to get months and years besides guessing days / 30 for
> months etc?
The age function will give a difference in years-months in addition to
days-hours-minutes-seconds.
Depending on what you want, it may not do exactly what you want.
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2005-01-26 20:13 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-25 15:11 datediff is there something like it? Joel Fradkin <jfradkin@wazagua.com>
2005-01-25 16:33 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2005-01-25 17:54 ` Joel Fradkin <jfradkin@wazagua.com>
2005-01-25 19:03 ` Oleg Bartunov <oleg@sai.msu.su>
2005-01-26 20:13 ` Bruno Wolff III <bruno@wolff.to>
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