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;


  • 相关阅读:
    bzoj 2878: [Noi2012]迷失游乐园
    端口安全检查shell脚本
    Linux安全基线检查脚本
    kali修改时区
    Elasticsearch+Kibana+Logstash安装
    go基础语法
    windows server 2012泛域名解析配置
    域名解析知识总结
    DDOS防护原理
    kali 2.0下搭建DVWA环境
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3225857.html
Copyright © 2011-2022 走看看