//取得某月的最后一天
    //方法一:使用算出該月多少天,年+月+加上多少天即得,舉例取今天這個月的最后一天
    private void GetLastDateForMonth(DateTime DtStart, out DateTime DtEnd)
    {
        int Dtyear, DtMonth;
        DtStart = DateTime.Now;
        Dtyear = DtStart.Year;
        DtMonth = DtStart.Month;
        int MonthCount = DateTime.DaysInMonth(Dtyear, DtMonth);//計算該月有多少天
        DtEnd = Convert.ToDateTime(Dtyear.ToString() + "-" + DtMonth.ToString() + "-" + MonthCount);
    }

本日志由 ceiling 于 2008-12-25 21:40:31 发表到 DotNet框架 中,目前已经被浏览 549 次,评论 0 次;

作者添加了以下标签: TimeSpanDateTimeC#

首页只显示了部分日志内容,要查看日志的全部内容请阅读全文