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.

相关阅读 >>

Delphi wmi 获取网络信息

Delphi 复制文件到剪贴板

Delphi createmessagedialog

Delphi 2009 中的泛型

Delphi unidac 连接mdb access 数据库

Delphi -- 农历算法单元

Delphi 截取被遮挡的window画面

Delphi java 日期 转换 获取unix时间戳

Delphi 使用 idhttp 获取 utf-8 编码的中文网页

Delphi 10.x ide界面

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...