Delphi如何获取时间月份

uses SysUtils;
 
//先使用
function Now: TDateTime;//返回当前年月日和时间
//然后使用
function FormatDateTime(const Format: string; DateTime: TDateTime): string;//输出你所需要的任何格式的时间字符串
 
//应用:
var
sMonth : String;
sTime: String;
sMonth := FormatDateTime('mm', Now); //你所需要的
sTime := FormatDateTime('yyyy-mm-dd, hh:nn:ss', Now);//年月日,时分秒
 
提问者评价谢谢
原文地址:https://www.cnblogs.com/huapox/p/3299833.html