我想将文本框转换为日期格式。我试过这个,但它说字符串不被识别为有效的日期时间。请帮忙 [英] I want to convert textbox into date format. I tried this one, but it says string was not recognized as a valid datetime. Please help

查看:70
本文介绍了我想将文本框转换为日期格式。我试过这个,但它说字符串不被识别为有效的日期时间。请帮忙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将日期从ASP.NET中的文本框保存到SQL Server中。



我尝试了什么: < br $>


I want to save the date from the textbox in ASP.NET into the SQL Server.

What I have tried:

DateTime dt = DateTime.Parse(datepicker1.Text);

推荐答案

使用 DateTime.TryParseExact [ ^ ]并使用datepicker使用的格式。
Use DateTime.TryParseExact[^] and use the format your datepicker uses.


这篇关于我想将文本框转换为日期格式。我试过这个,但它说字符串不被识别为有效的日期时间。请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆