protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "Select Date:-";
Calendar1.SelectedDate = DateTime.Now;
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Label1.Text = Label1.Text + Calendar1.SelectedDate.ToShortDateString();
}
在标签中,它以mm-dd-yyyy格式显示 但我希望格式为dd-mm-yyyy。
答案 0 :(得分:1)
试试这个:
Label1.Text = Label1.Text + Calendar1.SelectedDate.ToString("dd-MM-yyyy");