How to force 12 hour clock

3 posts, 0 answers
  1. Kevon Hayes
    Kevon Hayes avatar
    34 posts
    Member since:
    Apr 2010

    Posted 17 Apr 2012 Link to this post

    Is there a property to force a 12 hour clock for the RadScheduler... when I select the times for the event from the Start Time and End Time dropdowns it displays 24 hour clock times.  I'd like this to be 12 hour clock only.
  2. Plamen
    Admin
    Plamen avatar
    3079 posts

    Posted 18 Apr 2012 Link to this post

    Hi Kevon,

     
    You can set the time format in the FormCreated event of RadScheduler as in the code:

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
       {
           if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
           {
               RadTimePicker startTime = e.Container.FindControl("StartTime") as RadTimePicker;
               startTime.TimeView.TimeFormat = "hh:mm tt";
               startTime.TimeView.DataList.DataSource = null;
               startTime.DataBind();
               RadTimePicker endTime = e.Container.FindControl("EndTime") as RadTimePicker;
               endTime.TimeView.TimeFormat = "hh:mm tt";
               endTime.TimeView.DataList.DataSource = null;
               endTime.DataBind();
           }
       }

    Hope this will be helpful.

    All the best,
    Plamen Zdravkov
    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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Alec
    Alec avatar
    4 posts
    Member since:
    Oct 2011

    Posted 21 Jan 2013 Link to this post

    Hello Kevon,

    You can try the below code property as well to set the 12 hour format.



     <telerik:RadTimePicker ID="TPEndTime" runat="server">
              <TimeView ID="TimeView1" TimeFormat="hh:mm tt" Interval="00:30" Columns="4" runat="server" />
    </telerik:RadTimePicker>

    TimeFormat="hh:mm tt"   == small hh used to show the, 12 hours format with AM /PM

    TimeFormat="HH:mm tt"  == CAPITAL HH used to show the miltary time, 24 hour format.

    Thanks
    Alec
Back to Top