delphi 怎样 取得 系统 月份

来源:百度知道 编辑:UC知道 时间:2024/05/31 00:13:26
为什么我使用 monthof() 系统认不到
实在是不好意思 加入单元是什么意思 谢谢
我才学

首先应加入单元 DateUtils ,然后就可以了。
eg:
在某一按钮中加入
var
i:word;
begin
i:=monthof(datetimepicker1.Date);
edit1.Text:=inttostr(i);

你太苯了,没人愿意回答你的问题的,这么简单的问题还问,自己去查API

我没用过Delphi,但用API肯定可以

GetSystemTime或者GetLocalTime

下面是MSDN中的资料:

The GetSystemTime function retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC).

void GetSystemTime(
LPSYSTEMTIME lpSystemTime
);

Parameters
lpSystemTime
[out] Pointer to a SYSTEMTIME structure to receive the current system date and time.

Return Values
This function does not return a value.

SYSTEMTIME

The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.

typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHou