delphi 获取中文/数字星期的函数  
官方Delphi 学习QQ群: 682628230(三千人)
频道

delphi 获取中文/数字星期的函数


unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}



function  GetWeekNo:string;
const
 WeekList:Array [0..6] of ShortString = ('周日','周一','周二','周三','周四','周五','周六');
begin
  Result := IntToStr(DayOfWeek(Now)-1);
end;


function GetWeek: string;
var
  mytime:SYSTEMTIME;
begin
  GetLocalTime(mytime);
  //Result := WeekList[mytime.wDayOfWeek];
  case mytime.wDayOfWeek of
    0: Result:='周日';
    1: Result:='周一';
    2: Result:='周二';
    3: Result:='周三';
    4: Result:='周四';
    5: Result:='周五';
    6: Result:='周六';
  end;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin

Caption:=GetWeek+' '+GetWeekNo;

end;

end.

推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号

执行时间: 0.037819147109985 seconds