vcl-151002-expressscheduler-how-to-change-the-time-ruler-s-time-format.md
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.
// ...
#include "cxSchedulerUtils.hpp"
// ...
class TcxSchedulerCustomDateTimeHelper: public TcxSchedulerDateTimeHelper {
public:
bool __fastcall GetIs24HourTimeFormat(TMetaClass* vmt);
};
bool __fastcall TcxSchedulerCustomDateTimeHelper::GetIs24HourTimeFormat(TMetaClass* vmt) {
return false;
}
__fastcall TDemoBasicMainForm::TDemoBasicMainForm(TComponent* Owner): TForm(Owner)
{
TcxSchedulerCustomDateTimeHelper* dthelper = new TcxSchedulerCustomDateTimeHelper();
try {
dthelper->GetIs24HourTimeFormat(DateTimeHelper);
dthelper->Refresh(DateTimeHelper);
}
__finally {
delete dthelper;
}
}
The following image shows the result of the code execution:
See Also