- TextBox1.Text = DateTime.Now.ToString( );
→呈現格式(如):2014/11/17
---------------------------------------------------
昨天日期:
- DateTime.Now.AddDays(-1).ToString("yyyy/MM/dd");
→呈現格式(如):2014/11/16
----------------------------------------------------
明天日期:
--------------------------------------------------
----------------------------------------------------
明天日期:
- DateTime.Now.AddDays(1).ToString("yyyy/MM/dd");
→呈現格式(如):2014/11/18
--------------------------------------------------
上個月日期:
DateTime.Parse(DateTime.Now.ToString("yyyy/MM/dd")).AddMonths(-1).ToShortDateString( );
--------------------------------------------------
下個月日期:
DateTime.Parse(DateTime.Now.ToString("yyyy/MM/dd")).AddMonths(1).ToShortDateString( );
--------------------------------------------------
本年度第一天:
DateTime.Parse(DateTime.Now.ToString("yyyy/01/01")).ToStringDateString( );
--------------------------------------------------
本年度最後一天:
DateTime.Parse(DateTime.Now.ToString("yyyy/01/01")).AddYears(1).AddDays(-1).ToStringDateString( );
沒有留言:
張貼留言