Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Advanced Datediff Formula (Tax Years Calc) Post Reply Post New Topic
Author Message
DRT79
Newbie
Newbie


Joined: 08 Oct 2010
Location: United Kingdom
Online Status: Offline
Posts: 1
Quote DRT79 Replybullet Topic: Advanced Datediff Formula (Tax Years Calc)
    Posted: 08 Oct 2010 at 9:59am

I have been asked to create a report which calculates the total number of complete UK tax years (starting 06 April ending 05 April) between two dates e.g.

Start Period:       13/06/1993

End Period:         16/11/2010

The total number of COMPLETE tax years between the dates is:

Start Period:       05/04/1994

End Period          06/04/2010         =             16 Complete Tax Years

Please help experts, this is has taxed (no pun intended) me for a whole week!

Hopefully…

Dan

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 11 Oct 2010 at 3:39am
how about something like:
 
local numbervar totalDays := dateDiff("d", startDate, endDate);
local numbervar yrs := totalDays/365.25;
cint(yrs) //maybe fix()
 
any closer?
 
also, shouldn't the startDate be 6/4/1994 and endDate 5/4/2010?
 
HTH
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.