Skip to main content

How to Change the Time Ruler's Time Format

The default time format depends on regional settings. If you wish to enable 12-hour format regardless of system settings, override the TcxSchedulerDateTimeHelper‘s GetIs24HourTimeFormat method, as shown in the following example:

// ...
uses
  cxSchedulerUtils;
// ...
type
  TcxSchedulerCustomDateTimeHelper = class(TcxSchedulerDateTimeHelper)
  protected
    class function GetIs24HourTimeFormat: Boolean; override;
  end;
implementation
// ...
class function TcxSchedulerCustomDateTimeHelper.GetIs24HourTimeFormat: Boolean;
begin
  // specify that the 12-hour format is to be used
  Result := False;
end;
initialization
  // specify a custom date-time utility for the scheduler
  DateTimeHelper := TcxSchedulerCustomDateTimeHelper;
  // update the format
  DateTimeHelper.Refresh;
end.

The following image shows the result of the code execution:

See Also