473,394 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to find out the number of days in a financial year.

How to find out the number of days in a financial year.

suppose from date is sep1st,2006.and to date is aug24th,2009.

the entire range involves financial years.i.e.,

april1st,2006-march31st,2007
april1st,2007-march31st,2008
april1st,2008-march31st,2009
april1st,2009-march31st,2010.
we have to calculate the no.of days of last financial year..
waiting for reply..
Feb 4 '08 #1
2 6103
deepuv04
227 Expert 100+
How to find out the number of days in a financial year.

suppose from date is sep1st,2006.and to date is aug24th,2009.

the entire range involves financial years.i.e.,

april1st,2006-march31st,2007
april1st,2007-march31st,2008
april1st,2008-march31st,2009
april1st,2009-march31st,2010.
we have to calculate the no.of days of last financial year..
waiting for reply..

hi,
you need to use a function as

CREATE FUNCTION calcdays
(
@startyear int,
@endyear int
)
RETURNS int
AS
BEGIN

declare @count int
set @count = 0
while @startyear <= @endyear
begin
if @startyear % 4 = 0 set @count = @count + 1
set @startyear = @startyear + 1
end

RETURN @count

END
GO

and call the function as

select datediff(dd, '2006-09-01','2009-08-24' ) + dbo.calcdays(year('2006-09-01'),year('2009-08-24'))


If you want number of days for each interval write a stored procedure or function to get the values


thanks
Feb 4 '08 #2
amitpatel66
2,367 Expert 2GB
How to find out the number of days in a financial year.

suppose from date is sep1st,2006.and to date is aug24th,2009.

the entire range involves financial years.i.e.,

april1st,2006-march31st,2007
april1st,2007-march31st,2008
april1st,2008-march31st,2009
april1st,2009-march31st,2010.
we have to calculate the no.of days of last financial year..
waiting for reply..
Are you looking at finding the number of days between sep1st,2006.and to date is aug24th,2009 or something else?
Feb 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: chennakeshava_ramesh | last post by:
hi, I have a problem, I am not able to find out which day of the week it is using the calendar class. I am using set() function to set the date and want to find out which day i.e mon,tue etc of...
7
by: Shuffs | last post by:
Could someone, anyone please tell me what I need to amend, to get this function to take Sunday as the first day of the week? I amended the Weekday parts to vbSunday (in my code, not the code...
5
by: Ali Baba | last post by:
Hi, Is there is equivalent of VB's DateDiff() method in C#. I need to find difference in months between two dates that are years apart. Docs says that I can use TimeSpan like: TimeSpam ts =...
3
by: RD | last post by:
Say Company's financial year starts October First and say we are now March 17th. How do you determine which quarter of the Financial year - not the actual year - March 17th is in. Thanks for any...
29
by: james | last post by:
I have a problem that at first glance seems not that hard to figure out. But, so far, the answer has escaped me. I have an old database file that has the date(s) stored in it as number of days. An...
23
by: thebjorn | last post by:
For the purpose of finding someone's age I was looking for a way to find how the difference in years between two dates, so I could do something like: age = (date.today() - born).year but that...
5
by: Beemer Biker | last post by:
I cant seem to get that date into any DateTime to make my calculation directly by subtracting "01-01-0000" from "now". After reading this:...
2
by: crabb | last post by:
I would like to know if anyone knows how to set up an app that would count the number of specific days in a user defined year. example, how many Sundays, Mondays, Tuesdays, etc. in 2007 or a user...
14
by: Tommy Jakobsen | last post by:
Hi. Is there a method in .NET that takes "year" as an argument and returns the total number of weeks in that year? For culture da-DK (Danish). Thanks in advance. Tommy.
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.