delphi日期函数
Day 开头的函数
●
Unit
DateUtils
function DateOf(const Avalue: TDateTime): TDateTime;
描述
使用 DateOf 函数用来把一个 TDateTime 类型的变量转变成一个
只带有日期的 TDateTime 类型变量。
例如:
showmessage(DateTimetostr(dateof(now())));
你得到的是 2003/03/19
而 showmessage(DateTimetostr((now())));
得到的是 2003/03/19 10:50:49
●function DateTimeToStr(DateTime: TDateTime): string;
描述
DateTimeToString 函数将 TDateTime 类型的参数 DateTime 转换成一个
字符串,使用给定的全局变量 ShortDateFormat 的格式,时间部分按照
给定的全局变量 LongTimeFormat 的格式。
其中 DateTime 为零的部分将不会显示出来。
例如:
ShortDateFormat:=’yyyy mm dd’;
showmessage(DateTimetostr((now())));
你将得到:2003 03 19 10:50:49
●procedure DateTimeToString(var Result: string; const Format: string; DateTime: TDateTime);
描述:
DateTimeToString 方法将TDateTime类型的参数DateTime 按照由参数Format提供的格式
转化成字符串,并保存在Result中。
对于Format的格式类型,请看 Date-Time format strings 的帮助。
例如:
DateTimeToString(result,’yyyy mm dd’,now());
那么 result的结果为:2003 03 19 10:50:49
●procedure DateTimeToSystemTime(DateTime: TDateTime; var SystemTime: TSystemTime);
描述:
有时为了调用API函数来使用系统时间,你可以使用 DateTimeToSystemTime 方法,来将一个
TDateTime 类型的时间变量转换成一个 TSystemTime 类型的 系统时间。
●function DateTimeToUnix(const Avalue: TDateTime ): Int64;
描述:
使用 DateTimeToUnix 函数来将一个 TDateTime 型时间变量转换成一个相应的 Unix 格式
的日期和时间。
Unix date-and-time values are encoded as the number of seconds that have elapsed
since midnight at the start of January 1, 1970.
●function DateToStr(Date: TDateTime): string;
描述:
使用 DateToStr 函数能得到 TDateTime 日期时间类型的日期部分。日期的转换格式依赖于
全局变量 ShortDateFormat。
●function DayOf(const Avalue: TDateTime): Word;
描述:
对于给定的TDateTime类型的日期时间,使用 DayOf 函数能得到该日期是该月份的第几天。
该函数的返回数值在 1
相关文档:
{-----------------------------------------------------------------------------
Unit Name: HashTable
Author: LiuHeng
Date: 2010-04-13
Purpose: 封装Delphi的HashTable
History:
------------------------------- ......
http://book.77169.com/data/web5302/20050228/20050228__3692503.html
ActiveX 和 Web
在Windows 操作系统下,有一个重要的机制,就是OLE ,就是可以让某
个应用程序(OLE Controller)访问其它应用程序(OLE Server)所提供的
功能,这样做的好处是,如果已经有了完成某项功能的程序,你就不必再为
某项功能编写特定 ......
过程无返回值,函数有返回值。
procedure MyProc(m,n : Integer; o : String; p : Single = 2.5; q : String = 'Delphi');
如上例所示,过程声明和定义中,多个参数是用分号隔开的,但在调用时是用逗号隔开的 。eg:
......
var
ExcelFile:string;
SourceRange,DesRange:Variant;
Row,Column,i:integer;
begin
if OpenDialog1.Execute then
begin
ExcelFile:=OpenDialog1.Files[0];
if not FileExists(ExcelFile) then Exit;
end
else
Exit;
try
ExcelApp:=CreateOleObject('Excel.Application');
......
//定义全局变量
public
{ Public declarations }
outlook,MailItem,Recipient:variant;
OutlookNameSpace:variant;
OutlookFolder:variant;
OutlookAttachment:variant;
//创建打开outlook
procedure TForm1.CreateOutLook;
begin
try
outlook:=CreateOleObject('OutLook.app ......