How does I count workdays between two dates by managed code? - InfoPath Dev Sign in | Join | Help in Newbie Questions InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » Newbie Questions » How does I count workdays between two dates by managed code? How does I count workdays between two dates by managed code? Last post 11-09-2007 10:07 AM by jatuphum. 4 replies. Page 1 of 1 (5 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 11-07-2007 02:24 AM jatuphum Joined on 09-24-2007 Posts 68 How does I count workdays between two dates by managed code? Reply Contact Hi all, I want to count workdays between two dates, such as 12 Dec 2007 to 11 Jan 2008. I want to use by managed code. Cheers. インフォパス ● デべロッパー 11-07-2007 05:34 AM In reply to Clay Fox Joined on 06-27-2006 USA Posts 1,935 Re: How does I count workdays between two dates by managed code? Mark as Not AnswerMark as Answer... Reply Contact The common way is to use the Datediff function and VBscript. Many examples here but here is onewith code. http://www.infopathdev.com/forums/p/5646/21172.aspx#21172 Clay Fox / Microsoft InfoPath MVP 11-08-2007 11:17 PM In reply to jatuphum Joined on 09-24-2007 Posts 68 Re: How does I count workdays between two dates by managed code? Mark as Not AnswerMark as Answer... Reply Contact Hi Clay, Thank you for your reply. But I explain to you about my problem. I don't want include of 'Saturday' and 'Sunday' of week. May be I use loop for solve this problem? Cheers. インフォパス ● デべロッパー 11-09-2007 07:30 AM In reply to Clay Fox Joined on 06-27-2006 USA Posts 1,935 Re: How does I count workdays between two dates by managed code? Mark as Not AnswerMark as Answer... Reply Contact You would have to use more complex logic and calculate the number of Saturdays and Sundays between your two dates and then subtract that from your total. I believe with DateDiff there is a way to get day of week so you could use this to filter the results which would be counted and step through (while loop) each following date and if it was not a weekend add to your sum value. Clay Fox / Microsoft InfoPath MVP 11-09-2007 10:07 AM In reply to jatuphum Joined on 09-24-2007 Posts 68 Re: How does I count workdays between two dates by managed code? Mark as Not AnswerMark as Answer... Reply Contact Hi Clay, Thank you again. Because while loop from your Idea so now I can solve my problem. Cheers. インフォパス ● デべロッパー Page 1 of 1 (5 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
Hi all,
I want to count workdays between two dates, such as 12 Dec 2007 to 11 Jan 2008.
I want to use by managed code.
Cheers.
The common way is to use the Datediff function and VBscript. Many examples here but here is onewith code.
http://www.infopathdev.com/forums/p/5646/21172.aspx#21172
Hi Clay,
Thank you for your reply. But I explain to you about my problem.
I don't want include of 'Saturday' and 'Sunday' of week.
May be I use loop for solve this problem?
You would have to use more complex logic and calculate the number of Saturdays and Sundays between your two dates and then subtract that from your total. I believe with DateDiff there is a way to get day of week so you could use this to filter the results which would be counted and step through (while loop) each following date and if it was not a weekend add to your sum value.
Thank you again. Because while loop from your Idea so now I can solve my problem.