This is a migrated thread and some comments may be shown as answers.

[Solved] TimePicker cannot change dropdown list to 24hr

8 Answers 167 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Samir
Top achievements
Rank 1
Samir asked on 03 Dec 2010, 05:04 AM
Hi,
The current TimePicker dropdown list show the time in AM and PM.
As I am using this TimePicker to show UTC time, then I need to the Time picker to show time in 24 hr and not AM/PM in its dropdown list, is that possible at this stage.

Thanks,
Samir.

8 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 03 Dec 2010, 12:19 PM
Hi,
I am having the same problem here. This is also a problem in teh DateTimePicker.
I would like to have the dropdown list show the time values according to the formating specified:
When I set "HH:mm" for the time part formatting I would like to see a list starting with 00:00 up to 23:59 ....

Also globalization is not working correct in this part.

Thanks,
Richard
0
Accepted
Georgi Krustev
Telerik team
answered on 03 Dec 2010, 05:08 PM
Hello,

For the time being time format of the hours list can be changed with javascript only. Here is a code snippet showing this:
function TimePickerOnLoad(e) {
    $(this).data('tTimePicker').timeView.format = "HH:mm";
}

Format of the time part in the datetimepicker is set to the $.telerik.cultureInfo.shortTime value. If the page is globalized then the time should be set to the correct time format. In order to globalize page you need to call Globalization(true):
<% Html.Telerik().ScriptRegistrar().Globalization(true); %>

I have attached a simple test project which shows the aforementioned approached.

Regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richard
Top achievements
Rank 1
answered on 03 Dec 2010, 05:15 PM
Great thanks!,

this works also for the DateTimePicker.

Regards,
Richard
0
Samir
Top achievements
Rank 1
answered on 04 Dec 2010, 04:57 AM
Excellent, thanks very much.
0
Håvard
Top achievements
Rank 1
answered on 18 May 2012, 09:29 AM

the javascript doesn't seem to have any effect now on version 2012.1.214.340

the onload scripts are firing and firebug reports no javascript errors, but still AM/PM format is showed.

0
Georgi Krustev
Telerik team
answered on 22 May 2012, 01:39 PM
Hello HÃ¥vard,

I have updated the test project to Q1 2012 SP version of Telerik Extensions for ASP.NET MVC and everything seems to be OK on my end. It is attached to this message. Check it and let me know if I am missing something. 

All the best,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Håvard
Top achievements
Rank 1
answered on 01 Jun 2012, 12:06 PM
sorry, my issue wasn't related to the version after all, if I specify a default value in the control it seems to stop working. like this:

Html.Telerik().DateTimePicker()
        .Name("DateTimePicker")
	.Value(DateTime.Now).Format("yyyy/mm/dd HH:mm")
        .ClientEvents(events => events.OnLoad("DateTimePickerOnLoad"))
0
Georgi Krustev
Telerik team
answered on 05 Jun 2012, 06:51 AM
Hi,

 
Yes, you are right. In that case, you will need to rebind the timeView:

function DateTimePickerOnLoad(e) {
        var dateTimePicker = $(this).data('tDateTimePicker');
        dateTimePicker.timeFormat = "HH:mm";
        dateTimePicker.timeView.format = "HH:mm";
        dateTimePicker.timeView.bind();
    }
Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Date/Time Pickers
Asked by
Samir
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Georgi Krustev
Telerik team
Samir
Top achievements
Rank 1
Håvard
Top achievements
Rank 1
Share this question
or