zoukankan
html css js c++ java
[转] c# 时间操作
一、取某月的最后一天
一、取某月的最后一天
法一、使用算出该月多少天,年
+
月
+
加上多少天即得,举例取今天这个月的最后一天
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);
}
法二、取出下月的第一天减去一天便是这个的最后一天
private
void
GetLastDateForMonth(DateTime DtStart,
out
DateTime DtEnd)
{
int
Dtyear,DtMonth;
DtStart
=
DateTime.Now.AddMonths(
1
);
Dtyear
=
DtStart.Year;
DtMonth
=
DtStart.Month;
DtEnd
=
Convert.ToDateTime(Dtyear.ToString()
+
"
-
"
+
DtMonth.ToString()
+
"
-
"
+
"
1
"
).AddDays(
-
1
);
}
法一、使用算出该月多少天,年
+
月
+
加上多少天即得,举例取今天这个月的最后一天
法二、取出下月的第一天减去一天便是这个的最后一天
查看全文
相关阅读:
js五种继承优缺点
golang---panic/recover
golang---应用OOM
golang--- context
常用工具及日常
golang --- pipline
golang 竞争---翻译
深入golang之---goroutine并发控制与通信
rpm打包
k8s-operator指北
原文地址:https://www.cnblogs.com/xiang/p/454957.html
最新文章
day06 is,id,编码,小数据池
day05 字典
day04 列表 增删改查 元组 range
day03 int 字符串 常用操作方法 for循环
day02 循环 运算符 格式化输出 编码
day01 认识python变量 数据类型 条件if语句
onload事件的加载
2015-8-27浦东环监项目-相关性配置记录
2015-8-26虚拟机相关问题解决办法
2015-8-25关于学习方法(控件)
热门文章
2015-8-25-关于后端的知识以及常用函数整理
2015-8-18环监培训
DS公共代码
工作流认识
工作培训日常2015/8/13整理
脚手架搭建vue框架
用脚手架创建vue项目
webpack 安装,打包使用
require模块化载入
js常用的数组,,字符串,,Math..正则方法
Copyright © 2011-2022 走看看