https://www.thaicreate.com/community/windows-form-datetimepicker.html
using System.Globalization;
using System.Threading;
if (fromDate.Value.Date <= toDate.Value.Date)
{
CultureInfo _cultureEnInfo = new CultureInfo("en-US");
DateTime dateBEgin = Convert.ToDateTime(this.fromDate.Value, _cultureEnInfo);
DateTime dateEnd = Convert.ToDateTime(this.toDate.Value, _cultureEnInfo);
//this.lblEng.Text = dateEng.ToString("dd MMM yyyy", _cultureEnInfo);
this.lblEng.Text = dateBEgin.ToString("yyyy MM dd", _cultureEnInfo);
lblEndate.Text = dateEnd.ToString("yyyy MM dd", _cultureEnInfo);
lblXX.Text = getDate(fromDate);
MessageBox.Show("OK");
}
else
{
MessageBox.Show("พ่องตาย");
}
----------------------------------------------
private string getDate(DateTimePicker d)
{
string xx;
CultureInfo _cultureEnInfo = new CultureInfo("en-US");
DateTime xDate = Convert.ToDateTime(d.Value, _cultureEnInfo);
xx = xDate.ToString("yyyyMMdd", _cultureEnInfo);
return xx;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น