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 函数能得到该日期是该月份的
相关文档:
最近做一个项目,要用Delphi,以前从未学过,好是费劲啊,哈哈光是字符串切割这个问题就困扰了几个小时,通过查资料终于解决,在这与大家分享一下
Function split(src: pchar; ch: char):TStringList;
// 分割字符串
var
i: Integer;
tmp : string;
begin
Result:=TStringList.Create;
......
1、准备
GPS(Global Positioning System),即全球定位系统,利用24颗GPS卫星的测距和测时功能进行全球定位,在许多系统中,如机场导航系统,出租车辆管理和调度系统、江河流域的灾害信息管理和预测系统中,GPS得到了广泛的应用。本文利用MSCOMM控件实现了GPS数据的采集,可为信息管理和指挥调度等提供定位数据。
......
......
一、概述及示例代码
Delphi中包括许多已经封装好的类及控件,其中的非可视化控件库以功能方式划分可处理诸多应用需求。若使用C++实现系统时对某些功能简单调用delphi中现成的库时即可。因此将delphi中的库以DLL形式封装好之后如何将方法导出可供C++调用是本文记录的重点。C++调用的方式有多种,在这里只讨论一种静 ......