在窗体中有两个组合框,内容分别为年和月。
我现在想通过api取得系统时间,日期,用什么函数

解决方案 »

  1.   

    API如下: 
    GetLocalTimeSyntaxVOID GetLocalTime(LPSYSTEMTIME lpst)LimitationsThis function returns the current time as local time.Now就表示当前系统的时间, TDateTime类型的
      

  2.   

    拟用两个EDIT分别显示日期和当前时间,例子如下://MM一定要大写,否则系统可能返回的是小时而不是月份
    edit1.text:=formatdatetime('yyyy-MM-dd',now);  //mm一定要小写,去分小时和月份
    edit2.text:=formatdatetime('hh-mm-ss',now)
    如上,不需要什么api,等待楼主给分
      

  3.   

    DELPHI6的WIN32页上有一个DateTimePicker1的时间控件,很好用,设置他的format属性为
    yyyy-MM-dd然后想显示系统时间就是DateTimePicker1.date:=now;这样就可以了,而且界面美观
      

  4.   

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Edit1.Text :=FormatDateTime('yyyy',Now);
      Edit2.Text :=FormatDateTime('mmmm',Now);
    end;function FormatDateTime(const Format: string; DateTime: TDateTime): string;
      

  5.   

    function Now: TDateTime;now:系统当前日期与时间,返回值为TDateTime类型!