Re: Time Intervals
От | Josh Berkus |
---|---|
Тема | Re: Time Intervals |
Дата | |
Msg-id | web-693157@davinci.ethosmedia.com обсуждение исходный текст |
Ответ на | Re: Time Intervals ("Michael Richards" <michael@fastmail.ca>) |
Список | pgsql-sql |
Michael, > The only solution I can think of is if I can convert a date into a > number of some sort and then just use normal math on it. I really > need: > > | now - then | > | ---------- | * (period+1) + then > |_ period _| > > That's basically find the amount of time since it's expired and > determine the number of periods between the expiry and now and take > the floor of it. Multiply that by the number of periods plus 1 to get > > the new expiry. > > Since there is no way to divide 2 intervals in postgres I believe I > need to find a way to turn a timestamp and an interval into a number. Hmmm ... yeah, you're right. Do you need the date+time or just thedate? If the latter, you can use the DATE data type,which isinteger-based. If the former, maybe the core team needs some help implementing * and /operators for TIMESTAMP and INTERVAL ... -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
В списке pgsql-sql по дате отправления: