반응형
procedure TForm1.FormShow(Sender: TObject);
var
wDate : TDateTime;
y,m,d : word;
begin
wDate := now; //현재일자
//wDate := StrToDate(FormatMaskText('0000-00-00;0', '20061215')); //테스트특정일자
//wDate := StrToDate(FormatMaskText('0000-00-00;0', '20070401')); //테스트특정일자
DecodeDate(wDate,y,m,d);
Label1.Caption := formatDateTime('yyyymmdd',wDate);
MaskEdit1.text := formatDateTime('yyyymmdd',IncMonth(wdate,1)-d); //월말
MaskEdit2.text := formatDateTime('yyyymmdd',IncMonth(wdate,-1)-d+1); //전월1일
MaskEdit3.text := formatDateTime('yyyymmdd',IncMonth(wdate,1)-d+1); //익월1일
MaskEdit4.text := formatDateTime('yyyymmdd',IncMonth(wdate,-m+1)-d+1); //당년시작일
MaskEdit5.text := formatDateTime('yyyymmdd',IncMonth(wdate,12-m+1)-d); //당년말일
MaskEdit6.text := formatDateTime('yyyy',wdate)+'0101'; //당년시작일, 단순
MaskEdit7.text := formatDateTime('yyyy',wdate)+'1231'; //당년말일, 단순
end;
var
wDate : TDateTime;
y,m,d : word;
begin
wDate := now; //현재일자
//wDate := StrToDate(FormatMaskText('0000-00-00;0', '20061215')); //테스트특정일자
//wDate := StrToDate(FormatMaskText('0000-00-00;0', '20070401')); //테스트특정일자
DecodeDate(wDate,y,m,d);
Label1.Caption := formatDateTime('yyyymmdd',wDate);
MaskEdit1.text := formatDateTime('yyyymmdd',IncMonth(wdate,1)-d); //월말
MaskEdit2.text := formatDateTime('yyyymmdd',IncMonth(wdate,-1)-d+1); //전월1일
MaskEdit3.text := formatDateTime('yyyymmdd',IncMonth(wdate,1)-d+1); //익월1일
MaskEdit4.text := formatDateTime('yyyymmdd',IncMonth(wdate,-m+1)-d+1); //당년시작일
MaskEdit5.text := formatDateTime('yyyymmdd',IncMonth(wdate,12-m+1)-d); //당년말일
MaskEdit6.text := formatDateTime('yyyy',wdate)+'0101'; //당년시작일, 단순
MaskEdit7.text := formatDateTime('yyyy',wdate)+'1231'; //당년말일, 단순
end;
반응형