不用Strtodate 还有其他方法吗?
解决方案 »
- 誰有興趣開發這樣的Grid控件?
- 这种方法创建的COM是否不支持后期绑定(CreateOleObject)
- BOF 或 EOF 中有一个是"真",或者当前的记录已被删除,但应用程序要求操作的是当前的记录。
- 求援!!!我使用DBgrideh连了一个数据表,并显示,我想双击表中的一条记录,并使该记录的背景变成另一个指定颜色!怎么做?在线等!!!
- ShellExecute(0,'open',Pchar(URL_Name),Nil,Nil,SW_NORMAL);不能在dll中使用
- 有偿索取xls处理模块
- 关于Indy TCP传输文件的简单问题
- 动态生成的ADOQuery控件到底能不能完全释放?动态生成数据控件再使用效率如何?请指教!
- 请教问题?
- 怎样在程序中动态的改变QuickRep的纸张大小呢?
- 简单的图表显示,请帮忙看看啦
- 如何让一个delphi的类继承一个窗体,同时实现一个自己定义的接口
MyDate: TDateTime;
begin
MyDate := EncodeDate(StrToInt(Edit1.Text), StrToInt(Edit2.Text), StrToInt(Edit3.Text));
Label1.Caption := DateToStr(MyDate);
end;
MyDate: TDateTime;
begin
MyDate := EncodeDate(StrToInt(Edit1.Text), StrToInt(Edit2.Text), StrToInt(Edit3.Text));
Label1.Caption := DateToStr(MyDate);
end;
EncodeDate 是把年月日生成一个日期
procedure TForm1.Button1Click(Sender: TObject);var
MyDate: TDateTime;
begin
MyDate := EncodeDate(StrToInt(Edit1.Text), StrToInt(Edit2.Text), StrToInt(Edit3.Text));
Label1.Caption := DateToStr(MyDate);
end;
Decodedate 是把数字合成一个日期
procedure TForm1.Button1Click(Sender: TObject);var
Present: TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
Present:= Now;
DecodeDate(Present, Year, Month, Day);
Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
+ IntToStr(Month) + ' of Year ' + IntToStr(Year);
DecodeTime(Present, Hour, Min, Sec, MSec);
Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
+ IntToStr(Hour);
end;
function Copy(S; Index, Count: Integer): string;
var s:string;
begin
s:='123456789' ;
edit1.Text:=copy(s,4,length(s));
end;
var s:string;
begin
s:='dhdhduiaaa';
edit1.Text:=inttostr(pos('i',s));
end;
function TryEncodeDate(Year, Month, Day: Word; out Date: TDateTime): Boolean;DescriptionEncodeDate returns a TDateTime value from the values specified as the Year, Month, and Day parameters.The year must be between 1 and 9999.Valid Month values are 1 through 12.Valid Day values are 1 through 28, 29, 30, or 31, depending on the Month value. For example, the possible Day values for month 2 (February) are 1 through 28 or 1 through 29, depending on whether or not the Year value specifies a leap year.If the specified values are not within range, EncodeDate raises an EConvertError exception.TryEncodeDate is identical to EncodeDate, except that TryEncodeDate responds to out of range parameters by returning False instead of raising an exception.
s: string;
temp: string;
i: integer;
begin
s := 'abcdefg';
temp := '';
for i := 1 to length(s) do
if (s[i] <> 'c') then
temp := temp + s[i] else
begin
if trim(temp) <> '' then
showmessage(trim(temp)); //把trim(temp)放到你想要的地方。
temp := '';
end;
if trim(temp) <> '' then
showmessage(trim(temp)); //把trim(temp)放到你想要的地方。
end;