How to change DateTimePicker style in ASP.NET?

1 Answer 41 Views
Date/Time Pickers
Janko
Top achievements
Rank 1
Iron
Iron
Janko asked on 25 Oct 2023, 09:00 AM
How to set DateTimePicker to use European style calendar (weeks start on Monday) and 24 hour time picker?

1 Answer, 1 is accepted

Sort by
1
Accepted
Alexander
Telerik team
answered on 30 Oct 2023, 06:43 AM

Hi Janko,

Generally, the TimeFormat option will only adjust the 24-hour mark within the boundaries of the popup time view. Thus, in order to function in a symbiotical manner, I would also recommend explicitly setting the .Format() API configuration as well.

Here is an example:

@(Html.Kendo().DateTimePicker()
    .Name("datetimepicker")
    .Format("MM/dd/yyyy HH:mm")
    .TimeFormat("HH:mm")
)

This will then produce the following result:

When it comes to the European style of the calendar, the Telerik UI for ASP.NET Core DateTimePicker and Calendar use the current culture of the application more predominantly.

If you set the culture globally or per widget, Monday as the start of the week will be shown if the culture utilizes it:

 
<script src="https://kendo.cdn.telerik.com/2023.3.1010/js/cultures/kendo.culture.en-GB.min.js"></script>

@(Html.Kendo().DateTimePicker()
    .Name("datetimepicker")
    .Culture("en-GB")
    .Format("MM/dd/yyyy HH:mm")
    .TimeFormat("HH:mm")
    .DateInput()
)

Which will then transpose the calendar view to the following incarnation:

For your convenience, here is a Telerik REPL example that tackles the aforementioned suggestions:

I hope this helps.

Kind Regards,
Alexander
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tags
Date/Time Pickers
Asked by
Janko
Top achievements
Rank 1
Iron
Iron
Answers by
Alexander
Telerik team
Share this question
or