我想在DBGrid显示的日期格式为:2003年12月1日 这样子格式的日期,但是摸索了很久都没找出办法来。望请指教!=========================
1.在SQL语句中使用select Convert(varchar, GetDate(), 101)得出来的日期格式无法使用xxxx年xx月xx日这样子的格式。2.不能像使用TTable使用
shortdateformat := 'YYYY-MM-DD';
DateSeparator := '-';3.千万别说改控制面版的设置。
调试欢乐多
SystemTime: TSystemTime;
str:string;
begin
GetLocalTime(SystemTime);
with SystemTime do
str := trim(inttostr(SystemTime.wYear))+'年'+trim(inttostr(SystemTime.wMonth))+'月'+trim(inttostr(SystemTime.wDay))+'月';
edit1.Text:=str;
end;
convert(varchar(4),Month(convert(varchar(20),getdate())))+'月'+
convert(varchar(4),Day(convert(varchar(20),getdate())))+'日'
str(year(getdate()),4) + '年' + str(month(getdate()),2) + '月' + str(day(getdate()),2) + '日'
+cast(datepart(mm,getdate()) as varchar)+'月'
+cast(datepart(dd,getdate()) as varchar)+'日'
条条道路通罗马啊~
呵呵
宝贝,
上面的东西你实践过没有啊,没有就不要瞎说
AS varchar) + '月' + CAST(DAY(date) AS varchar) + '日' AS date1
FROM tablename这个是直接用SQL转换的.
1992年8月27日
1990年12月24日
1990年9月13日
1989年9月21日
1991年2月13日是你想要的结果吗?
上次少写单引号了(你没看出来吗?):
FormatDateTime('yyyy''年''mm''月''dd''日''', now())
谢谢各位,看来使用DBGrid1DrawDataCell是无法解决的了。