有四种方法:
方法一、
SysUtils.FormatDateTime('yyyy-mm-dd',Business.Data.SysSrv.SysService.Time).Substring(0,4);
SysUtils.FormatDateTime('yyyy-mm-dd',Business.Data.SysSrv.SysService.Time).Substring(6,2);
SysUtils.FormatDateTime('yyyy-mm-dd',Business.Data.SysSrv.SysService.Time).Substring(9,2);
方法二、
Dialogs.ShowMessage(SysUtils.IntToStr(Business.System.DateUtils.Monthof(Business.Data.SysSrv.SysService.Time)));
Dialogs.ShowMessage(SysUtils.IntToStr(Business.System.DateUtils.Yearof(Business.Data.SysSrv.SysService.Time)));
方法三、
就是使用代码实现:
procedure TMainForm.Button1Click(Sender: TObject);
var
y, m, d: word;
dt : TDateTime;
begin
dt := DateTimePicker1.Date;
SysUtils.DecodeDate(dt, y, m, d);
end;
方法四、
Value := IntTostr(yearof(SysService.Time))+TJustepCommonUnit.StrToRightLenStr(Value.ToString, '0', 6);
Value := IntTostr(Monthof(SysService.Time))+TJustepCommonUnit.StrToRightLenStr(Value.ToString, '0', 6);
//SysService 在 Business.Data.SysSrv 下 |