System.DateTime dt = System.DateTime.Now;
System.DateTime ThisMonBeginDay = new System.DateTime(dt.Year, dt.Month, 1);
System.DateTime UltMonEndDay = ThisMonBeginDay.AddDays(-1);
System.DateTime ThisMonEndDay = ThisMonBeginDay.AddMonths(1).AddDays(-1);
利用System.DateTime Contructor找出本月月初的日期。上月月底 = 本月月初 - 1天;本月月底 = 本月月初 + 1個月 - 1天。如此利用簡單的概念即可算出日期。
另外System.Globalization命名空間中提供了2個類別:TaiwanCalendar、TaiwanLunisolarCalendar。
System.DateTime dt = System.DateTime.Now;
TaiwanCalendar tc = new TaiwanCalendar();
int Year = tc.GetYear(dt);
// 97
int Mon = tc.GetMonth(dt);
// 6
int day = tc.GetDayOfMonth(dt);
// 9
TaiwanLunisolarCalendar tlc = new TaiwanLunisolarCalendar();
int LuniYear = tlc.GetYear(dt);
// 97
int LuniMon = tlc.GetMonth(dt);
// 5
int Luniday = tlc.GetDayOfMonth(dt);
// 6
綜合上述可以得到以下這張圖

Big Data and Hadoop is an ecosystem of open source components that fundamentally changes the way enterprises store, process, and analyze data.
ReplyDeletepython training in bangalore
aws training in bangalore
artificial intelligence training in bangalore
data science training in bangalore
machine learning training in bangalore
hadoop training in bangalore
devops training in bangalore
corporate training certification
ReplyDeletecorporate training companies in mumbai
corporate training companies in pune
corporate training companies in delhi
corporate training companies in chennai
corporate training companies in hyderabad
corporate training companies in bangalore
Gaining Python certifications will validate your skills and advance your career.
ReplyDeletepython certification
Excellent Blog. Thank you so much for sharing.
ReplyDeletepython training in bangalore | python online training
aws online training in bangalore | aws online training
artificial intelligence training in bangalore | artificial intelligence online training
machine learning training in bangalore | machine learning online training
data science training in bangalore | data science online training