I have one problem. In code I have set the format for display the date time as below image:
But the result still show as below format:
How can I change the format for this problem.
I have one problem. In code I have set the format for display the date time as below image:
But the result still show as below format:
How can I change the format for this problem.
You can't change this format
It gets the format from the OS. The input format will be varying depending on the international settings of the OS. It could also depend on the browser and the OS of the client computer too.
According to this question
We have to differentiate between the over the wire format and the browser's presentation format.
Wire format The HTML5 date input specification 1 refers to the RFC3339 specification [2], which specifies a full-date format equal to: yyyy-mm-dd. See section 5.6 of the RFC3339 specification for more details.
Presentation format Browsers are unrestricted in how they present a date input. At the time of writing Chrome has the most extensive date support [3]. It displays a date picker using the user's local calendar format. Opera (v10.6+) also displays a date picker, but shows the date in the wire format. Other browsers, such as Firefox 24 and Internet Explorer 9/10 display a text input field with the wire format.
References
1 http://www.w3.org/TR/html-markup/input.date.html
2 https://www.rfc-editor.org/rfc/rfc3339
3 https://plus.google.com/102860501900098846931/posts/hTcMLVNKnec
You can't do it using pure HTML, You can use combination of jQuery
and Masked input plugin like
jQuery(function($){
$("#date").mask("99/99/9999",{placeholder:"mm/dd/yyyy"});
});
try to use the
String.Format
method
something like this:
Convert.ToDateTime(String.Format(yourDate.ToLongDateString(), "dd/MM/yy"))