Joined: 12 Nov 2007
Location: United States
Online Status: Offline
Posts: 93
Topic: Convert date to fiscal year Posted: 29 Nov 2007 at 3:48pm
Hello experts,
How can I convert a date to a fiscal year?
In the report that I am creating,
the user inputs, 200710 (which is a number filed in database) as a parameter. 2007 as year and 10 as month. Now I need to convert that to FY 08. Fiscal year 08 starts in July of 2007 and ends in June of 2008. I have converted the parameter to a date field in crystal reports.So how do I convert that date to a fiscal year for my report heading. Please advise.
Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Posted: 04 Dec 2007 at 10:27am
There are two ways of doing this.
Year(DateAdd("m",6,{MyDateField})
That method may get a little quirky with dates right around the change of the fiscal year. You may need to add a day or two, or something of that nature.
The other method is more involved, but more accurate generally:
If Month({MyDateField}) < 7 Then Year ({MyDateField}) Else Year({MyDateField}) + 1
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