Ask Experts Questions for FREE Help !
Ask
    Mistery1's Avatar
    Mistery1 Posts: 39, Reputation: 1
    Junior Member
     
    #1

    Mar 3, 2009, 02:05 AM
    Leave days
    Hi there,

    I need help with calculating leave days in vb.net. I need to calculate the total number of leave days taken, also leave days should not include and weekends and public holidays.
    Perito's Avatar
    Perito Posts: 3,139, Reputation: 150
    Ultra Member
     
    #2

    Mar 4, 2009, 06:01 AM

    I think I'd like a bit more information.

    It's not difficult to calculate days between two dates. I'm sure I could look up an algorithm (I don't have one right off my head), but most of them use the concept of a "Julian date". Loosely, some date is given the date of zero. From then on, the date is subsequently increased for each successive day. (A purist's Julian date starts at January 1, 4713 BC, but we don't care about that). So, you figure out what beginning and ending dates you care about and subtract them. The difference is the number of days between them. If you want to include both end dates, you have to add a 1.

    After that, you need to figure out how many weekends and public holidays there are. For that, you need a list of public holidays (there is no universal list). You calculate the day of the week for the Julian Days at the beginning and ending of the period and from there you can figure out how many Saturdays and Sundays there are. From the list of holidays, you can subtract out those.

    If you wish to pursue this, I can look up an algorithm to calculate Julian days from some arbitrary date (not necessarily 4717 BC) and the days of the week.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

How long do I have to leave being evicted. They gave me 2 days. [ 1 Answers ]

I haven't packed anything, and the real estate broker sent a letter that states that I have to be out in 2 days. It seems like an unrealistic time table considering the size of the house and the amount of time it would take to remove items. I don't know Texas law, but don't they have to take me...

How Many days can a mother leave her childern [ 5 Answers ]

How many days can a mother leave her children with no contact before it is abandonment?

Need to give 60 days notice, but rent is increasing in thirty days [ 3 Answers ]

I have rented the condo I am in now for over two years. After the initial lease term of one year, I went on a month-to-month basis. I am required to give 60 days notice prior to vacating the property. My landlord notified me at the end of this month (february) that the rent would be...


View more questions Search