zoukankan      html  css  js  c++  java
  • delphi中设置系统时间方法

    procedure TMainFrm.Timer1Timer(Sender: TObject);
    var
      systemtime:Tsystemtime;
      dt:TDateTime;
    begin
      L_DateTime.Caption:=FormatDateTime('YYYY-MM-DD HH:SS',Now); //显示当前时间

      MainFrm.Caption:=IntToStr(Timer1.Tag);
      timer1.tag:=timer1.tag+1;
      if Timer1.tag=60 then begin
         Timer1.tag := 0;
         if (PC1.ActivePage <> Page_start) then begin
            Btn_Input_FirstClick(nil);  //返回首页
         end;
      end;

      if copy(L_DateTime.Caption,12,5)='02:00' then begin  //晚两点同步时间
         try
           DM.GetTime.Open;
           dt := DM.GetTimeCurrTime.Value;
           DateTimeToSystemTime(dt,systemtime);   //把Delphi的TDateTime格式转化为API的
           SetLocalTime(SystemTime);   //设置系统时间
           //GetLocalTime(SystemTime);   //读取系统时间
           //DateTime:=SystemTimeToDateTime(SystemTime);   //把API的TSystemTime格式   转化为   Delphi的TDateTime格式
         finally
         end;
      end;
    end;


  • 相关阅读:
    莫队专题
    AJAX XML 实例
    AJAX 简介
    AJAX 服务器响应
    AJAX 创建XMLHttpRequest 对象
    AJAX 教程
    AJAX 向服务器发送请求
    AJAX onreadystatechange 事件
    AJAX ASP/PHP 请求实例
    让卖场的死角“起死回生”
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3225857.html
Copyright © 2011-2022 走看看