Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8324409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:03:55+00:00 2026-06-09T00:03:55+00:00

I am working on an attendance software in asp.net, in it i have to

  • 0

I am working on an attendance software in asp.net, in it i have to make a report which will tell the user about the hours and everything…so far i have created the basic functionality of the system, i.e. the user can check in and check out…i am stuck at making the report…

I have to calculate the working hours for every month, so the user can compare his hours with the total hours…what i had in mind was to create a stored procedure which when given a month name and a year, returns an int containing working hours for that month….but i can seem to get at it….

so far i found out how to create a date from a given month and a date, and found out the last day of that month, using which i can find out the total days in month…now i cant seem to figure out how do i know how much days to subtract for getting the working days.

here’s the so far code..

declare 
@y int,
@m int,
@d int,
@date datetime


set @y = 2012
set @m = 01
set @d = 01

----To create the date first
select @date = dateadd(mm,(@y-1900)* 12 + @m - 1,0) + (@d-1) 
----Last Day of that date
SELECT DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@date)+1,0))

any help will be appreciated guys, thanks in advance….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:03:59+00:00Added an answer on June 9, 2026 at 12:03 am

    The @theDate is any date on the month you want to calculate the work days. This approach does not take care about holidays.

    DECLARE @theDate DATETIME = GETDATE()
    SELECT MONTH(@theDate) [Month], 20 + COUNT(*) WorkDays
      FROM (
             SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, @theDate), 28) AS theDate
              UNION
             SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, @theDate), 29)
              UNION
             SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, @theDate), 30)
            ) AS d
     WHERE DATEPART(DAY, theDate) > 28
       AND DATEDIFF(DAY, 0, theDate) % 7 < 5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was working on an attendance system on ASP.Net where the entire week's dates
i'm working on an attendance program and i have this requirement to be able
I am working on an attendance system in PHP, attendance will be recorded with
Working on a website http://www.ArenaText.com written in asp.net with Microsoft AJAX control toolkit. iPad
I have developed an online leave management system in PHP, MySQL, which is working
I have an attendance table which contains student's attendance date and attendance status. Is
I have a working mysql query which returns all of the people NOT registered
I'm working on an ASP.Net application and working to add some Ajax to it
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports
Working on game where plates will be falling from top to bottom. Some plates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.