<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-8-I"
http-equiv="Content-Type">
<title></title>
</head>
<body alink="#ee0000" bgcolor="#ffffff" link="#0000ee" text="#33ff33"
vlink="#551a8b">
<font color="#000000"><tt>Hi list,<br>
<br>
I need to know whether a repeating event occurs or not on a particular
day. I currently have the following information:<br>
<br>
date of first occurrence (date)<br>
repeat frequency (interval)<br>
date to check (date)<br>
<br>
My instinct says that I should be using a mod here to calculate whether
the remainder is zero when the difference between the two times is
divided by the repeat frequency. Unfortunately this is not possible
since as far as I am aware intervals only specify a time length and not
two dates. When searching I discovered tinterval which appears to do
what I would want, and was surprised to discover that it is not
supported in my postgres install because it is too _new_ !?! (PG 8.1).<br>
<br>
I then considered trying to extract the units from the repeat_frequency
interval and then calculating the difference between date_to_check and
first_occurrence in those units (eg weeks, months). But I was unable to
find a reasonable way to find out the units of an interval.<br>
<br>
I could try an approximation using </tt><tt class="LITERAL"><code
class="FUNCTION">justify_interval() and friends and then use a short
loop to get an accurate result. This is also a hack.</code></tt><br>
<tt><br>
This has to be a very standard requirement. How does one go about
calculating whether a difference between two dates is a multiple of a
particular interval in an elegant fashion ?<br>
<br>
<br>
Thanks,<br>
<br>
Netzach<br>
</tt></font>
<br>
</body>
</html>