delphi里的时间字段为2001-11-11,怎样显示为汉字,或者在报表打印为汉字?即打印为'二00一年十一月十一日'我用的报表是fastreport2.47
解决方案 »
- 一个字符截取函数
- 麻烦各位大哥推荐几本好的DELPHI(或者VC也行)网络编程(涉及讨论TCP协议)的书籍(如果是可以下载的电子书就更好喽,呵呵)..
- 怎么样把execl文件存到数据库中
- 一个很简单的问题
- 有几个简单的问题,想请教一下!!!
- 有谁知道Ehlib1.54版本作者茶壶的qq或者msn号吗
- 鼠标托动效果如何实现?(在线等候)
- 急!急问了几天了如何编写.vxd文件屏蔽键盘和屏蔽F5,F8键
- 最近学习FASTREPORT做了个程序,一同学习的人可以帮着看一下。
- 求救sqlserver的 BDE配置方法,步骤。
- adoquery1判断重复一提交post就出错
- 请问一个filesize的问题~~
const
numtochar:array[0..9] of string =('〇', '一', '二', '三', '四', '五', '六','七','八','九');
numtomonth:array[0..9] of string =('十','一', '二', '三', '四', '五', '六','七','八','九');
var
fmts:string;//格式时间字符变量.
nowy,nowm,nowd :string; //当前年月日变量.中文
nowy1,nowy2,nowy3,nowy4,nowm1,nowm2,nowd1,nowd2:integer;//子变量.
begin
fmts:=formatdatetime('yyyy-mm-dd',dt);
//转换当前年份
nowy1:=strtoint(copy(fmts,1,1));
nowy2:=strtoint(copy(fmts,2,1));
nowy3:=strtoint(copy(fmts,3,1));
nowy4:=strtoint(copy(fmts,4,1));
nowy:=numtochar[nowy1]+numtochar[nowy2]+numtochar[nowy3]+numtochar[nowy4];
//转换当前月份
nowm1:=strtoint(copy(fmts,6,1));
nowm2:=strtoint(copy(fmts,7,1));
case nowm1 of
0: nowm:=numtomonth[nowm2]; //eg:01
1:
if nowm2=0 then
nowm:=numtomonth[0] //eg:10
else
nowm:=numtomonth[0]+numtomonth[nowm2]; //eg:11
end;
//转换当前日期
nowd1:=strtoint(copy(fmts,9,1));
nowd2:=strtoint(copy(fmts,10,1));
case nowd1 of
0: nowd:=numtomonth[nowd2]; //eg:01
1:
if nowd2=0 then
nowd:=numtomonth[0] //eg:10
else
nowd:=numtomonth[0]+numtomonth[nowd2]; //eg:11
else
begin
if nowd2=0 then
nowd:=numtomonth[nowd1]+numtomonth[0] //eg:20 or 30
else
nowd:=numtomonth[nowd1]+numtomonth[0]+numtomonth[nowd2]; //eg:21 or 31
end;
end;
Result := nowy+'年'+nowm+'月'+nowd+'日';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text := DateToCnStr(datetimepicker1.Date);
end;
Const
Arr1:array[0..10] of string=('〇','一','二','三','四','五','六','七','八','九','十');
Arr2:array[0..2] of string=('年','月','日');
var
s:string;
i,j:Integer;
begin
s:=FormatDateTime('yyyymmdd',sDate);
for i:=1 to 8 do
begin
j:=StrToInt(s[i]); if not (i in [5,7]) then
if not ((i in [6,8]) and (j=0)) then
result:=result+Arr1[j]; case i of
4,6,8:result:=result+Arr2[round((i-4)/2)];
5,7:case j of
1:result:=result+Arr1[10];
2,3:result:=result+Arr1[j]+Arr1[10];
end;
end
end;
end;