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

How can I Display TimeFormat "HH:mm:ss"

5 Answers 600 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tim Anderson
Top achievements
Rank 1
Tim Anderson asked on 09 Jun 2008, 01:24 AM
Am I missing something?

On the DateTimePicker and TimePicker you can easily set the TimeView.TimeFormat to something like "HH:mm:ss", to cause the TimePicker popup to display values like "23:00:00", but the textbox for the control still displays values like "6/8/2008 11:00 PM".

I would like the "11:00 PM" to display as "23:00:00" so the user can adjust down to the second, if needed.

Where is that format set?
Thanks!

5 Answers, 1 is accepted

Sort by
0
Baatezu
Top achievements
Rank 2
answered on 09 Jun 2008, 03:43 AM
The RadDateTimePicker.DateInput.DisplayDateFormat needs to be changed. I assume you know what they need to be set to to display in 24 hour with seconds. I did a quick demo site to find a solution, this is what I have in the ASPX
<telerik:RadDateTimePicker ID="RadDateTimePicker1" Runat="server"  
        Culture="English (United States)"
        <TimeView TimeFormat="HH:mm:ss"
        </TimeView> 
<DateInput InvalidStyleDuration="100" DisplayDateFormat="M/d/yyyy HH:mm:ss"></DateInput> 
    </telerik:RadDateTimePicker> 
for my RadDateTimePicker. It shows the time in 24 with seconds after they have selected.

Hope that helps.
0
Tim Anderson
Top achievements
Rank 1
answered on 09 Jun 2008, 04:18 AM
Thanks, Baatezu -

That gets me closer. (The help files seem to be missing these TimePicker controls and I didn't dig deep enough into Intelisense to find RadDateTimePicker.DateInput.DisplayDateFormat.)

With your changes, the DateTimePicker now displays the correct format, but only if you set the value in code, or after selecting a Date or a Time from the respective pop-ups.

When you click on the DateInput text box to edit it directly, it immediately reverts to the original format.

For example, I set the control to DateTime.Now and it shows "6/8/2008 21:14:53" - as soon as I click on it to edit it, it says "6/8/2008 9:14 PM", so I can't adjust the seconds.

Both the RadDateTimePicker and RadTimePicker behave this way.
0
Accepted
Baatezu
Top achievements
Rank 2
answered on 09 Jun 2008, 04:33 AM
RadDateTimePicker.DateInput.DateFormat set to the same thing as DisplayDateFormat fixed that for me.
0
Tim Anderson
Top achievements
Rank 1
answered on 09 Jun 2008, 04:48 AM
That did the trick.

Works for both RadDateTimePicker and RadTimePicker from either .aspx or code-behind, but both properties need to be set.

Thanks again!
0
sgrover
Top achievements
Rank 1
answered on 15 Sep 2018, 12:39 PM
And for me.  Cheers
Tags
General Discussions
Asked by
Tim Anderson
Top achievements
Rank 1
Answers by
Baatezu
Top achievements
Rank 2
Tim Anderson
Top achievements
Rank 1
sgrover
Top achievements
Rank 1
Share this question
or