如题
如何得到datetime类型的年月日 时分秒的值
如何得到datetime类型的年月日 时分秒的值
解决方案 »
- 邮件发送不完整
- 使用case of 的问题,请看正文,谢谢!
- sheets.Cells.Find为什么老出 类 Range的Find方法无效,该怎么写呢????我是这么写的:Sheet.Cells.Find('#Q.F1',Null,xlFormulas,xlP
- 关于拖放的问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 在编译包时出现以下提示,怎么办?
- 尚未解决的SQL问题
- 急啊?求解啊?
- 这样在遍历数据库中的表名?
- 新裝上Delphi的第二個補丁﹕D6_upd2_ent.exe﹐我的程序就不能編譯通過了。
- 我也想知道
- 在机房管理中,C/S结构,数据库的如何设计?
- 求助关于TidMessage(邮件)的编码问题
monthof
yearof
secondof
...
var
AYear,AMonth,ADay,AHour,AMinute,ASecond,AMilliSecond:Word;
begin
DecodeDateTime(now,AYear,AMonth,ADay,AHour,AMinute,ASecond,AMilliSecond);
label1.Caption:=floattostr(ayear);
label2.Caption:=floattostr(AMonth);
label3.Caption:=floattostr(ADay);
label4.Caption:=floattostr(AHour);
label5.Caption:=floattostr(AMinute);
label6.Caption:=floattostr(ASecond);
label7.Caption:=floattostr(AMilliSecond);
end;
unit DealDate;interface
uses SysUtils;function DaysInMonth(ADate:TDateTime):Integer;
function GetMonth(ADate:TDateTime):Integer;
function GetDay(ADate:TDateTime):Integer;
function GetYear(ADate:TDateTime):Integer;
function Gethour(ADate:TDateTime):Integer;
function Getminute(ADate:TDateTime):Integer;
function Getsecond(ADate:TDateTime):Integer;implementationfunction GetMonth(ADate:TDateTime):Integer;
var
MyMonth, MyYear, MyDay : Word;
begin
DecodeDate(ADate, MyYear, MyMonth, MyDay);
Result:=mymonth;
end;function GetDay(ADate:TDateTime):Integer;
var
MyMonth, MyYear, MyDay : Word;
begin
DecodeDate(ADate, MyYear, MyMonth, MyDay);
result:=myday;
end;function GetYear(ADate:TDateTime):Integer;
var
MyMonth, MyYear, MyDay : Word;
begin
DecodeDate(ADate, MyYear, MyMonth, MyDay);
result:=myyear;
end;function Gethour(ADate:TDateTime):Integer;
var
Hour, Min, Sec, MSec: Word;
begin
DecodeTime(ADate, Hour, Min, Sec, MSec);
result:=Hour;
end;function Getminute(ADate:TDateTime):Integer;
var
Hour, Min, Sec, MSec: Word;
begin
DecodeTime(ADate, Hour, Min, Sec, MSec);
result:=Min;
end;function GetSecond(ADate:TDateTime):Integer;
var
Hour, Min, Sec, MSec: Word;
begin
DecodeTime(ADate, Hour, Min, Sec, MSec);
result:=sec;
end;function DaysInMonth(ADate:TDateTime):Integer;
var
MyMonth,
MyYear,
MyDay : Word;
tmpBool : Boolean;
begin
DecodeDate(ADate, MyYear, MyMonth, MyDay);
tmpBool := IsLeapYear(MyYear);
case mymonth of
1,3,5,7,8,10,12 :result:=31;
4,6,9,11 :result:=30;
2 :
begin
if TmpBool then
result:=29
else
result:=28
end;
end;
end;
end.