问题是这样的,我或A时间代表上班,和B 时间代表下班 ,然后B时间减去A时间,获得今天的工作时间,因为时间是字符串类型,所以不能相减,我是新手,大家指点,指点。
解决方案 »
- 关于delphi获取天气信息的问题
- rtl60.bpl错误问题
- 一个小问题,在线等待!
- 拦载串口数据
- 类定义里的Private里面的单元的访问的问题
- fastreport顯示問題
- 如何让MDI子窗体最大化时充满MDI窗体的Client区域,而且不会掩盖MDI窗体的Toolbar,也就是只填满MDI窗体ToolBar下面的Client区域,还有当其
- 如何浮点数格式化为 11,111,111.11格式啊?
- !!! 高手指点,在线等待,帮帮我啊,谢谢!!!
- 关于动态创建文件夹然后保存的问题
- TeeChart5.02当把横坐标(时间yyyy/mm/dd hh:nn:ss)分为两行之后,坐标的第二行与它的title重叠,怎么解决?
- 关于DBGriD的的几个问题
time1,time2,time3:TDatetime;h,m,s:integer;begintime3:=time1-time2;decodetime(time3,h,m,s);result:=h*3600+m*60+s;end;
用hoursbetween函數.
i:integer;i:=Trunc(24 * (StrToTime(Time2) - StrToTime(Time1)));oruses DateUtilsi:=HoursBetween(Time2,Time1);这种补充真是别扭啊
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Button2: TButton;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
time1,time2,time3: string;
h,m,s: integer;
i:integer;
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
label1.caption:=datetimetostr(now);
time1:=datetimetostr(now);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
label2.caption:=datetimetostr(now);
time2:=datetimetostr(now);
begin
i:=Trunc(24 * (StrToTime(Time2) - StrToTime(Time1)));
end;
label3.Caption:=i;
end;end.错误信息
[Error] Unit1.pas(52): Incompatible types: 'String' and 'Integer'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'