.net一个时间字段有年月日时分秒,我怎么能把他们分解开显示的前台分别在lable上一个一个赋值
2个回答
展开全部
这样写
Label1.Text = Convert.ToDateTime(datestring).Year.ToString() + "年";
Label2.Text = Convert.ToDateTime(datestring).Month.ToString() + "月";
Label3.Text = Convert.ToDateTime(datestring).Date.ToString() + "日";
Label4.Text = Convert.ToDateTime(datestring).Hour.ToString() + "小时";
Label5.Text = Convert.ToDateTime(datestring).Minute.ToString() + "分钟";
Label6.Text = Convert.ToDateTime(datestring).Second.ToString() + "秒";
Label1.Text = Convert.ToDateTime(datestring).Year.ToString() + "年";
Label2.Text = Convert.ToDateTime(datestring).Month.ToString() + "月";
Label3.Text = Convert.ToDateTime(datestring).Date.ToString() + "日";
Label4.Text = Convert.ToDateTime(datestring).Hour.ToString() + "小时";
Label5.Text = Convert.ToDateTime(datestring).Minute.ToString() + "分钟";
Label6.Text = Convert.ToDateTime(datestring).Second.ToString() + "秒";
追问
谢谢 解决了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询