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);//年月日,时分秒
 
提问者评价谢谢
posted @ 2010-11-01 14:22  linux,dev  阅读(936)  评论(0编辑  收藏  举报