| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1263 人关注过本帖
标题:如何获取?
只看楼主 加入收藏
qpfmates
Rank: 1
等 级:新手上路
帖 子:409
专家分:0
注 册:2008-9-20
结帖率:100%
收藏
 问题点数:0 回复次数:5 
如何获取?
如何获取系统时间,如何获取系统日期?
搜索更多相关主题的帖子: 获取 
2008-10-29 14:28
ruanjian2110
Rank: 3Rank: 3
来 自:武汉
等 级:论坛游民
威 望:7
帖 子:486
专家分:50
注 册:2008-5-25
收藏
得分:0 
var
 ADate:TDateTime;
 ss:string;
 week:array[1..7]of  string;
 begin
   week[1]:='星期天';
   week[2]:='星期一';
   week[3]:='星期二';
   week[4]:='星期三';
   week[5]:='星期四';
   week[6]:='星期五';
   week[7]:='星期六';
   ADate:=strtodate(FormatDateTime('yyyy-mm-dd',now));
   ss:=FormatDateTime('yyyy"年"m"月"d"日"hh:nn:ss',now);
   Edit1.Text:='当前日期:'+ss+#0+week[DayOfWeek(ADate)];
 end;

武汉信控科技有限公司:http://www. 超越技术,本身就是一个美好技术。。。。。。
2008-10-29 15:24
dudu3118
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2008-9-8
收藏
得分:0 
回帖是一种美德!每次回帖即可获得 10 分可用积分!只看帖不回帖鄙视你。
用心参与大家的技术讨论,将有机会在每月的全民选举中获得 1-3 个威望。
2008-11-10 21:06
dudu3118
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2008-9-8
收藏
得分:0 
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Button1: TButton;
    Button2: TButton;
    Timer1: TTimer;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
 Timer1.Enabled:=true;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 Timer1.Enabled:=false;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
 var
    DateTime : TDateTime;
     Year, Month, Day, Hour, Min, Sec, MSec: Word;
  begin
   DateTime:= Now;
   DecodeDate(DateTime, Year, Month, Day);
   Label1.Caption:='Year: '+Inttostr(Year);
   Label2.Caption:='Month: '+Inttostr(Month);
   Label3.Caption:='Day: '+Inttostr(Day);
   DecodeTime(DateTime, Hour, Min, Sec, MSec);
   Label4.Caption:='Hour: '+Inttostr(Hour);
   Label5.Caption:='Min: '+Inttostr(Min);
   Label6.Caption:='Sec: '+Inttostr(Sec);
   Label7.Caption:='MSec: '+Inttostr(Msec)
end;

end.
2008-11-10 21:43
qpfmates
Rank: 1
等 级:新手上路
帖 子:409
专家分:0
注 册:2008-9-20
收藏
得分:0 
谢谢了!
2008-11-12 19:50
cwb19870802
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-7-28
收藏
得分:0 
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Button1: TButton;
    Button2: TButton;
    Timer1: TTimer;
  
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=true;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Timer1.Enabled:=false;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
    DateTime : TDateTime;
     Year, Month, Day, Hour, Min, Sec, MSec: Word;
  begin
   DateTime:= Now;
   DecodeDate(DateTime, Year, Month, Day);
   Label1.Caption:='Year: '+Inttostr(Year);
   Label2.Caption:='Month: '+Inttostr(Month);
   Label3.Caption:='Day: '+Inttostr(Day);
   DecodeTime(DateTime, Hour, Min, Sec, MSec);
   Label4.Caption:='Hour: '+Inttostr(Hour);
   Label5.Caption:='Min: '+Inttostr(Min);
   Label6.Caption:='Sec: '+Inttostr(Sec);
   Label7.Caption:='MSec: '+Inttostr(Msec);


end;

procedure TForm1.FormCreate(Sender: TObject);
begin

end;

end.
2009-07-28 19:38
快速回复:如何获取?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015939 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved