如何将htmltextboxfor设置为日期时间格式? [英] how to set htmltextboxfor as date time format ?
本文介绍了如何将htmltextboxfor设置为日期时间格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用HTML文本框在文本框中使用模型显示日期值。
这样的东西
@ Html.TextBoxFor(x => x.ReleaseDate)
我的日期格式是mm / dd / yyyy
现在当我插入的日期小于或等于12它工作正常但是当我选择大于12的日期时,它需要01/01/0001作为日期和数据不想保存。
p.s. :当在编辑模式下使用此代码时它工作正常但是当我们添加新数据时它不起作用
解决方案
使用此链接..
http://stackoverflow.com/questions/3734829/datetime-field-and-html-textboxfor-helper-how-to-use-it-correctly [ ^ ]
http://stackoverflow.com/questions/17850830/mvc-datetime-textbox-格式问题 [ ^ ]
http:/ /stackoverflow.com/questions/5583622/html-textbox-datetime-format [ ^ ]
http://geekswithblogs.net/80n/archive/2012/04/27/apply-a-datetime-format-in-an-asp。 net-mvc-textboxfor.aspx [ ^ ]
http://www.coderanch.com/t/583353/HTML-CSS-JavaScript/insert-current-date-time-textbox [ ^ ]
Hi ,
all i am using HTML textbox for to show date value in the text box using model.
something like this
@Html.TextBoxFor(x => x.ReleaseDate)
my date format is mm/dd/yyyy
now when i insert a date less then or equal to 12 it works fine but as i select date greater than 12 it takes 01/01/0001 as date and data do not want to save.
p.s. : when this code is used in edit mode it works fine but when we add a new data it do not work
解决方案
Use this links..
http://stackoverflow.com/questions/3734829/datetime-field-and-html-textboxfor-helper-how-to-use-it-correctly[^]
http://stackoverflow.com/questions/17850830/mvc-datetime-textbox-formatting-issue[^]
http://stackoverflow.com/questions/5583622/html-textbox-datetime-format[^]
http://geekswithblogs.net/80n/archive/2012/04/27/apply-a-datetime-format-in-an-asp.net-mvc-textboxfor.aspx[^]
http://www.coderanch.com/t/583353/HTML-CSS-JavaScript/insert-current-date-time-textbox[^]
这篇关于如何将htmltextboxfor设置为日期时间格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文