如何算数一个月中的哪几天(星期日或其他任何天除外)? [英] How to count the no. of days from a month excluding sunday or any other day?

查看:205
本文介绍了如何算数一个月中的哪几天(星期日或其他任何天除外)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个批处理计划应用程序..

因为可以每天安排批次

仅特定日期...

并且每个批次仅针对特定编号运行.天数

如果是特定日期,则我需要根据该批次的天数"(不包括其他日期)生成该批次的结束日期....


谁能帮忙... :)

谢谢:)

I m designing a batch scheduling application.. .

In that the batch can be scheduled on everyday basis
or
only for specific days...

and each batch runs for only specific no. of days

if it is for specific days than i need to generate the End Date of the Batch according to the "duration in days" of the batch excluding the other days....


Can anyone help... :)

Thanks :)

推荐答案

DateTime startDate = DateTime.Now;
DateTime endDate = startDate.AddDays(10);
int count = 0;
while(startDate < endDate)
{
    if(startDate.DayOfWeek != DayOfWeek.Sunday)
    {
        count++;
    }
    startDate = startDate.AddDays(1);
}


这篇关于如何算数一个月中的哪几天(星期日或其他任何天除外)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆