private void btntest_Click(object sender, EventArgs e)
{
DateTime d = new DateTime(2016,2,13);
LunarDate ld1 = LunarYearTools.SolarToLunar(d);
lblamlich.Text = (ld1.ToString());
}
注
DateTime d = new DateTime(Int year,Int month,Int day)
插入DateTimePicker的值轉換成funtion
如何插入DateTimePicker的價值爲new DateTime(2016,2,13)
??? 我試圖用鑄造日期時間到Int
,但沒有奏效:
string a = dateTimePicker1.Value.ToString();
int b = (int)(a);
DateTime d = new DateTime(b);
LunarDate ld1 = LunarYearTools.SolarToLunar(d);
lblamlich.Text = (ld1.ToString());
WOW。謝啦。理解我100%。有效! –
看這個人! :D sticked –
'Value'已經是一個DateTime,如果目標是隻有一天(沒有幾小時),那麼'var dateOnly = dateTimePicker1.Value.Date;'應該可能足夠 – pinkfloydx33