C++ Builder XE4 > TeeChart > DateTimeFormat > C++ 빌더의 표준 형식 > 24시간 표시/AMPM 표시[실패]
C++ Builder XE4
TChartAxis.DateTimeFormat
의 포맷 변경이 필요하게 되고, 조사하고 있으면 TeeChart의 헬프에는 이하의 기재가 있었다.
Description
Chart Axis have a DateTimeFormat property.
DateTimeFormat is a standard Delphi/C++Builder DateTime formatting string specifier.
Chart Axis uses it to draw the axis labels.
C++ Builder Date Time formatting을 IDE의 도움말에서 찾았지만 자신이 보고 싶은 정보에는 따라갈 수 없다.
별도로, google에서 DateTime을 조사하면 다음을 발견했다.
h tp // w w. 에서 lp 히바시 cs. 이. u k / RTL. 아 sp? name = fur t datechime
try
24시간 표기의 시각과 AM, PM표기의 시각을 시험했다.
IN_AMPM 매크로를 코멘트 아웃 하거나, 코멘트 하지 않는 것으로 전환한다.
Unit1.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <DateUtils.hpp>
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
#define IN_AMPM // AM/PM表示
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
Chart1->Series[0]->XValues->DateTime = true;
Chart1->BottomAxis->DateTimeFormat = L"nn:ss";
TDateTime dt;
dt = Now();
double yval;
for (int idx=0; idx < 10; idx++) {
yval = (1+ idx) % 2;
Series1->AddXY(dt, yval, "", clRed);
dt = IncSecond(dt, 1);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TDateTime stdt = Now();
TDateTime eddt = IncMinute(Now(), 480);
Chart1->BottomAxis->SetMinMax(stdt, eddt);
Chart1->BottomAxis->Increment = TTime(L"02:00");
#ifdef IN_AMPM
Chart1->BottomAxis->DateTimeFormat = L"hhampm:nn";
#else
Chart1->BottomAxis->DateTimeFormat = L"hh:nn";
#endif
}
Button1 실행 결과
24시간 표기
이쪽은 성공.
AM/PM 디스플레이 (트라이)
이쪽은 실패. PM의 표시가 아니라 「오후」가 되어 버렸다.
AM/PM표시는 곧바로 사용하지 않기 때문에 이번은 여기서 그만두지만, 실제로 사용할 때가 있으면 좀 더 조사해야 한다.
Reference
이 문제에 관하여(C++ Builder XE4 > TeeChart > DateTimeFormat > C++ 빌더의 표준 형식 > 24시간 표시/AMPM 표시[실패]), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/7of9/items/d38351ea15739ead009d텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)