asp.net中datetime转换成字符串怎么处理
答案:4 悬赏:0 手机版
解决时间 2021-12-21 12:17
- 提问者网友:骨子里的高雅
- 2021-12-20 21:43
asp.net中datetime转换成字符串怎么处理
最佳答案
- 五星知识达人网友:第幾種人
- 2022-01-22 06:04
private void Form1_Load(object sender, System.EventArgs e)
{
//textBox1.Text=DateTime.Now.ToString("dd/MM/yyyy");
//textBox1.Text=DateTime.Now.DayOfYear.ToString();
textBox1.Text=DateTime.Now.ToString("d");
textBox2.Text=DateTime.Now.ToString("D");
textBox3.Text=DateTime.Now.ToString("G");
textBox6.Text=DateTime.Now.ToString("g");
textBox5.Text=DateTime.Now.ToString("T");
textBox4.Text=DateTime.Now.ToString("t");
textBox12.Text=DateTime.Now.ToString("F");
textBox11.Text=DateTime.Now.ToString("f");
textBox10.Text=DateTime.Now.ToString("M");
textBox9.Text=DateTime.Now.ToString("R");
textBox8.Text=DateTime.Now.ToString("s");
textBox7.Text=DateTime.Now.ToString("u");
textBox13.Text=DateTime.Now.ToString("Y");
textBox14.Text=DateTime.Now.ToString("y");
}
{
//textBox1.Text=DateTime.Now.ToString("dd/MM/yyyy");
//textBox1.Text=DateTime.Now.DayOfYear.ToString();
textBox1.Text=DateTime.Now.ToString("d");
textBox2.Text=DateTime.Now.ToString("D");
textBox3.Text=DateTime.Now.ToString("G");
textBox6.Text=DateTime.Now.ToString("g");
textBox5.Text=DateTime.Now.ToString("T");
textBox4.Text=DateTime.Now.ToString("t");
textBox12.Text=DateTime.Now.ToString("F");
textBox11.Text=DateTime.Now.ToString("f");
textBox10.Text=DateTime.Now.ToString("M");
textBox9.Text=DateTime.Now.ToString("R");
textBox8.Text=DateTime.Now.ToString("s");
textBox7.Text=DateTime.Now.ToString("u");
textBox13.Text=DateTime.Now.ToString("Y");
textBox14.Text=DateTime.Now.ToString("y");
}
全部回答
- 1楼网友:独钓一江月
- 2022-01-22 07:35
试一试 datetime dt= parse.datetime(string str);函数,
将字符串str转换成datetime类型,之后赋值给dt
前提是你必须要保证你传出的字符串str是能够转换成datetime类型的时间值
- 2楼网友:舊物识亽
- 2022-01-22 07:17
对的,就是这个意思
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯