Localization
The DateInput displays the date in a format depending on the selected culture (the default culture is en-US
).
The following example demonstrates how to format the date in the German culture:
<script datasrc="@Url.Content("~/lib/kendo/js/cultures/kendo.culture.de-DE.min.js")"></script>
<script type="text/javascript">
kendo.culture("de-DE");
</script>
@{
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("de-DE");
}
@(Html.Kendo().DateInput()
.Name("dateinput")
.Value(DateTime.Today)
)
<script datasrc="@Url.Content("~/lib/kendo/js/cultures/kendo.culture.de-DE.min.js")"></script>
<script type="text/javascript">
kendo.culture("de-DE");
</script>
@{
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("de-DE");
}
<kendo-dateinput name="dateinput" value="DateTime.Today">
</kendo-dateinput>
To control the date format, use the Format()
method. The specified format also will be used to parse the input.
@(Html.Kendo().DateInput()
.Name("dateinput")
.Value(DateTime.Today)
.Format("dd-MM-yyyy")
)
<kendo-dateinput name="dateinput" value="DateTime.Today" format="dd-MM-yyyy">
</kendo-dateinput>