dbTalk Databases Forums  

format interval as days

comp.databases.postgresql comp.databases.postgresql


Discuss format interval as days in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Patrick Scharrenberg
 
Posts: n/a

Default Re: format interval as days - 05-09-2008 , 04:45 AM






Laurenz Albe schrieb:
Quote:
Patrick Scharrenberg <pittipatti (AT) web (DOT) de> wrote:
I'd like to represent an interval like '1 day 1h 2m 12s' in days, in
this case 25

I assume you mean "hours".
Ohh, yes you're right :-)
And thanks for your long answer!


Quote:
Is there a more convenient way of returning the number of hours than
with a contruct like the following?

I don't think there is a better way. You could write an SQL function around
it:
Oh, what a pity.
At least I can copy'n'paste your function ;-)



Quote:
And what if the interval is longer than a month?
How many day's has an "interval-month"?

There is an instructive comment in include/utils/timestamp.h:
#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
okay, I'll go with 30

Thank you Laurenz!

Patrick


Reply With Quote
  #22  
Old   
Patrick Scharrenberg
 
Posts: n/a

Default Re: format interval as days - 05-09-2008 , 04:45 AM






Laurenz Albe schrieb:
Quote:
Patrick Scharrenberg <pittipatti (AT) web (DOT) de> wrote:
I'd like to represent an interval like '1 day 1h 2m 12s' in days, in
this case 25

I assume you mean "hours".
Ohh, yes you're right :-)
And thanks for your long answer!


Quote:
Is there a more convenient way of returning the number of hours than
with a contruct like the following?

I don't think there is a better way. You could write an SQL function around
it:
Oh, what a pity.
At least I can copy'n'paste your function ;-)



Quote:
And what if the interval is longer than a month?
How many day's has an "interval-month"?

There is an instructive comment in include/utils/timestamp.h:
#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
okay, I'll go with 30

Thank you Laurenz!

Patrick


Reply With Quote
  #23  
Old   
Patrick Scharrenberg
 
Posts: n/a

Default Re: format interval as days - 05-09-2008 , 04:45 AM



Laurenz Albe schrieb:
Quote:
Patrick Scharrenberg <pittipatti (AT) web (DOT) de> wrote:
I'd like to represent an interval like '1 day 1h 2m 12s' in days, in
this case 25

I assume you mean "hours".
Ohh, yes you're right :-)
And thanks for your long answer!


Quote:
Is there a more convenient way of returning the number of hours than
with a contruct like the following?

I don't think there is a better way. You could write an SQL function around
it:
Oh, what a pity.
At least I can copy'n'paste your function ;-)



Quote:
And what if the interval is longer than a month?
How many day's has an "interval-month"?

There is an instructive comment in include/utils/timestamp.h:
#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
okay, I'll go with 30

Thank you Laurenz!

Patrick


Reply With Quote
  #24  
Old   
Patrick Scharrenberg
 
Posts: n/a

Default Re: format interval as days - 05-09-2008 , 04:45 AM



Laurenz Albe schrieb:
Quote:
Patrick Scharrenberg <pittipatti (AT) web (DOT) de> wrote:
I'd like to represent an interval like '1 day 1h 2m 12s' in days, in
this case 25

I assume you mean "hours".
Ohh, yes you're right :-)
And thanks for your long answer!


Quote:
Is there a more convenient way of returning the number of hours than
with a contruct like the following?

I don't think there is a better way. You could write an SQL function around
it:
Oh, what a pity.
At least I can copy'n'paste your function ;-)



Quote:
And what if the interval is longer than a month?
How many day's has an "interval-month"?

There is an instructive comment in include/utils/timestamp.h:
#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
okay, I'll go with 30

Thank you Laurenz!

Patrick


Reply With Quote
  #25  
Old   
Patrick Scharrenberg
 
Posts: n/a

Default Re: format interval as days - 05-09-2008 , 04:45 AM



Laurenz Albe schrieb:
Quote:
Patrick Scharrenberg <pittipatti (AT) web (DOT) de> wrote:
I'd like to represent an interval like '1 day 1h 2m 12s' in days, in
this case 25

I assume you mean "hours".
Ohh, yes you're right :-)
And thanks for your long answer!


Quote:
Is there a more convenient way of returning the number of hours than
with a contruct like the following?

I don't think there is a better way. You could write an SQL function around
it:
Oh, what a pity.
At least I can copy'n'paste your function ;-)



Quote:
And what if the interval is longer than a month?
How many day's has an "interval-month"?

There is an instructive comment in include/utils/timestamp.h:
#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
okay, I'll go with 30

Thank you Laurenz!

Patrick


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.