Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Convert date to fiscal year Post Reply Post New Topic
Author Message
fusion
Groupie
Groupie


Joined: 12 Nov 2007
Location: United States
Online Status: Offline
Posts: 93
Quote fusion Replybullet 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.

Thanks in advance. 

IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet 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


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.015 seconds.