J jericho3164 Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #1 改成2004-06-11,2004-06-06之类的格式?<br>
B bjaman Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #2 设置其Format属性,可设为:DateTimePicker1.Format := 'yyyy-MM-dd';
J jericho3164 Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #3 但是我SHowMessage(DateTimePicker1.date);后还是显示2004-6-12(窗体上显示2004-06-12)
B bjaman Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #4 把你系统控制面板里的区域设置里的日期格式也设成‘yyyy-MM-dd’吧。
T telliu Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #6 procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> DateTimePicker1.Format := '2004-06-06';<br>end;
procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> DateTimePicker1.Format := '2004-06-06';<br>end;
B bjaman Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #7 那就用Format()之类的函数,我在网吧,没办法查详细格式,你自己查帮助吧。。。
S sword_liu Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #8 ShowMessage(FormatDateTime('YYYYMMDD',DateTimePicker1.Date));
Y yczjs Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #9 ShortDateFormat:='yyyy-mm-dd';
W wqhatnet Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #10 procedure TeditForm.TableLogoBeforePost(DataSet: TDataSet);<br>var<br>list:TStringlist;<br>m,y,r:string;<br>begin<br>TableLogo['时间']:=DbCbTime.Text;<br>list:=TStringlist.Create;<br>list.Text:= StringReplace ( dateToStr(DateTimePicker1.date),'-',#13#10, [rfReplaceAll] );<br>y:=list.strings[0];<br>m:=list.strings[1];<br>r:=list.strings[2];<br>if length<3 then y:='20'+y;<br>if length(m)=1 then m:= '0'+m;<br>if length(r)=1 then r:= '0'+r;<br>m:=y+'-'+m;<br>r:=m+'-'+r;<br>TableLogo['日']:=r;<br>TableLogo['月']:=m;<br>TableLogo['年']:=y;<br>list.Destroy;<br>end;
procedure TeditForm.TableLogoBeforePost(DataSet: TDataSet);<br>var<br>list:TStringlist;<br>m,y,r:string;<br>begin<br>TableLogo['时间']:=DbCbTime.Text;<br>list:=TStringlist.Create;<br>list.Text:= StringReplace ( dateToStr(DateTimePicker1.date),'-',#13#10, [rfReplaceAll] );<br>y:=list.strings[0];<br>m:=list.strings[1];<br>r:=list.strings[2];<br>if length<3 then y:='20'+y;<br>if length(m)=1 then m:= '0'+m;<br>if length(r)=1 then r:= '0'+r;<br>m:=y+'-'+m;<br>r:=m+'-'+r;<br>TableLogo['日']:=r;<br>TableLogo['月']:=m;<br>TableLogo['年']:=y;<br>list.Destroy;<br>end;
H hygsxy Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-12 #11 format格式都没必要设置,formatdatetime就足够了。<br>ShowMessage(FormatDateTime('YYYY-MM-DD',DateTimePicker1.Date));<br>
format格式都没必要设置,formatdatetime就足够了。<br>ShowMessage(FormatDateTime('YYYY-MM-DD',DateTimePicker1.Date));<br>
C cjmchen Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-13 #12 FormatDateTime('YYYY-MM-DD',DateTimePicker1.Date)
L lymanrb Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-13 #13 如果不想在代码里面到处写 FormatDateTime 的话,就只有改注册表,把系统时间格式改成你想要的样子,如bjaman所说。改法如下(需要引用 Registry ):<br><br> SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, 'yyyy-MM-dd');<br> SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0,0);<br>
如果不想在代码里面到处写 FormatDateTime 的话,就只有改注册表,把系统时间格式改成你想要的样子,如bjaman所说。改法如下(需要引用 Registry ):<br><br> SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, 'yyyy-MM-dd');<br> SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0,0);<br>