您如何将2014年6月22日的价值更改为2014年6月22日 [英] How do you change the value 22/06/2014 to 22 June 2014
本文介绍了您如何将2014年6月22日的价值更改为2014年6月22日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< asp:TextBox ID =txtDateReadOnly =truerunat =server>
此文本框从datepicker收到一个值,即06/04/2014。我如何将其更改为2014年6月4日。?
<asp:TextBox ID="txtDate" ReadOnly="true" runat="server">
this textbox recieves a value from a datepicker which is 06/04/2014. how do i change this to 04 June 2014.?
推荐答案
尝试以下网址,提供10种在javascript中更改日期格式的方法
http://www.webdevelopersnotes.com/tips/html/javascript_date_and_time.php3 [ ^ ]
Number3正是你想要的
如果你想改变C#中的格式,你可以使用DateTime.ToString( 你的欲望格式)在以下链接中完整解释
http://msdn.microsoft.com/en-us/library/zdtaw1bw(v=vs.110).aspx [ ^ ]
try the following URL that provide 10 ways of changing date format in javascript
http://www.webdevelopersnotes.com/tips/html/javascript_date_and_time.php3[^]
Number3 is exactly what you want
if you want to change the format in C#, you could use DateTime.ToString("Your Desire format") which is completely explained in the following link
http://msdn.microsoft.com/en-us/library/zdtaw1bw(v=vs.110).aspx[^]
如果你想在页面上显示格式,那么在代码下面使用
if you want to display formatted on page then use
below code
<ajaxToolkit:Calendar runat="server"
TargetControlID="txtDate1"
CssClass="ClassName"
Format="dd MMMM yyyy"
如果你想把字符串值中的日期用于进一步操作然后使用这个
if you want to take date in string value for further manipulation then use this
DateTime dt = Convert.ToDateTime(txtDate1.text);
string s = dt.ToString("dd MMMM yyyy");
这篇关于您如何将2014年6月22日的价值更改为2014年6月22日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文