Hi,
I have a system that records insurance policies.
If the policy is cancelled then any part of a month insured is deducted
from the premium, so a policy that ran for 32 days would get a 10 month
rebate so would 58 days etc.
I've used:
TheStartDate = "2006-06-15" 'changed manually for now, usually ......
rsuser("PolicyStart")
DaysSinceInception = DateDiff("d",TheStartDate,Date)
MonthsSinceInception = DateDiff("m",TheStartDate,Date)
response.Write("Policy Start = " & TheStartDate & "<br>")
response.Write("Today = " & date & "<br>")
response.Write("Days Since Inception = " & DaysSinceInception & "<br>")
response.Write("Months Since Inception = " & MonthsSinceInception &
"<br>")
Example of results (Date is in UK format):
Policy Start = 2006-06-01
Today = 14/07/2006
Days Since Inception = 43
Months Since Inception = 1
Policy Start = 2006-06-11
Today = 14/07/2006
Days Since Inception = 33
Months Since Inception = 1
Policy Start = 2006-06-13
Today = 14/07/2006
Days Since Inception = 31
Months Since Inception = 1
Policy Start = 2006-06-15
Today = 14/07/2006
Days Since Inception = 29
Months Since Inception = 1
Policy Start = 2006-06-30
Today = 14/07/2006
Days Since Inception = 14
Months Since Inception = 1
~~~~~~~~~~~
Can anyone please help me to 'round up' the month?
In antipation, thank you
Jon 4 4410
Hi Jon,
Would this work? Just jump ahead a year to get the renewal date (or
whatever it may be called) and then count the month difference from that
date and today's date:
Function PolicyRefundMonthCount(InceptionDate)
Dim dRenewalDate
dRenewalDate = DateAdd("yyyy", 1, InceptionDate)
PolicyRefundMonthCount = DateDiff("M", Date, dRenewalDate)
End Function
Results with your test dates:
2006-06-01: 11
2006-06-11: 11
2006-06-13: 11
2006-06-15: 11
2006-06-30: 11
Ray at work
"J-P-W" <jo******@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi,
I have a system that records insurance policies.
If the policy is cancelled then any part of a month insured is deducted
from the premium, so a policy that ran for 32 days would get a 10 month
rebate so would 58 days etc.
I've used:
TheStartDate = "2006-06-15" 'changed manually for now, usually ......
rsuser("PolicyStart")
DaysSinceInception = DateDiff("d",TheStartDate,Date)
MonthsSinceInception = DateDiff("m",TheStartDate,Date)
response.Write("Policy Start = " & TheStartDate & "<br>")
response.Write("Today = " & date & "<br>")
response.Write("Days Since Inception = " & DaysSinceInception & "<br>")
response.Write("Months Since Inception = " & MonthsSinceInception &
"<br>")
Example of results (Date is in UK format):
Policy Start = 2006-06-01
Today = 14/07/2006
Days Since Inception = 43
Months Since Inception = 1
Policy Start = 2006-06-11
Today = 14/07/2006
Days Since Inception = 33
Months Since Inception = 1
Policy Start = 2006-06-13
Today = 14/07/2006
Days Since Inception = 31
Months Since Inception = 1
Policy Start = 2006-06-15
Today = 14/07/2006
Days Since Inception = 29
Months Since Inception = 1
Policy Start = 2006-06-30
Today = 14/07/2006
Days Since Inception = 14
Months Since Inception = 1
~~~~~~~~~~~
Can anyone please help me to 'round up' the month?
In antipation, thank you
Jon
Hi Ray,
Looked really good, but it has given me some of the same results, only
backwards.
I gave a start date of 10th August 05, so less than one month to go,
341 days gone, your function gave me 1 month as the result, but 24 days
needs to be less than 1!!!
I tried playing around with 13 - result and 12 - result - no good
either!!
Never mind, thanks for your efforts.
Maybe I'll just use multiple of 30 days :)
Jon
J-P-W wrote:
Hi Ray,
Looked really good, but it has given me some of the same results, only
backwards.
I gave a start date of 10th August 05, so less than one month to go,
341 days gone, your function gave me 1 month as the result, but 24
days needs to be less than 1!!!
I tried playing around with 13 - result and 12 - result - no good
either!!
Never mind, thanks for your efforts.
Maybe I'll just use multiple of 30 days :)
Jon
Use "d" instead of "m" in the DateDiff function to cause it to return te
number of days. Then divide by 30 ...
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Indeed, I think I'll have to do that, thanks, Jon This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Drago |
last post by:
Hi, I got the next question, I want to know the diference between two
dates
and thats is really easy, but my problem is get that diference in the
following format
ex. "the diference is= 0 year,...
|
by: charlesb |
last post by:
I have a query that works in the rest of the SQL world
"SELECT invoice.*, invoice.Date
FROM invoice
WHERE (DateDiff("m", Date, Now())=1);"
which will give me all of last month's invoices.
...
|
by: Paolo |
last post by:
I am having some problem with a Year Function.
I have form on which I have 4 field which indicate dates and an
additional form which sums those dates:
These are the fields:
YEARS...
|
by: mcbill20 |
last post by:
Hello all. I have a really basic question that I hope someone has a
better answer for. I apologize in advance-- I know this is probably a
really basic question but I am used to Oracle rathern than...
|
by: haydn_llewellyn |
last post by:
Hi,
My company runs on a fiscal calendar that starts on the first monday in
July, and is based on a 13 week quarter (4 weeks, 4 weeks, 5 weeks).
What I need, is a way of relating Date() to the...
|
by: Adrian |
last post by:
I hit on this problem converting a VB.NET insurance application to C#.
Age next birthday calculated from date of birth is often needed in
insurance premium calculations.
Originally done using...
|
by: Price Brattin |
last post by:
Why is the DateDiff function in the following code returning zero?
Dim FileDate, TransmissionDate as Date
Dim TranDay, FileDay, DayDiff as Inteter
TransmissionDate = #2/5/2006 1:57:56 PM#...
|
by: TofuTheGreat |
last post by:
I did a group search and found hundreds of cases of problems with
DateDiff(). I read through several dozen but they didn not apply to
my situation. Not having the time to read through all of them...
|
by: muddasirmunir |
last post by:
i am using vb 6 , i had place two datepicker in form now i want to calcuate differcen of month in two date for this i used the function datediff
i had try it withh many syntax but getting error...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |