不用Strtodate 还有其他方法吗?
解决方案 »
- 大家有没有碰到过,dxdbtreeview为什么窗体退出的时候,会自动删除数据!
- installshield express for delphi5打包提示 没有注册类别
- D2009关于winexec的问题
- missing SQl property什么问题啊
- data日期加上一年或一個月,怎麼做?
- 考试系统的问题
- tabel控件中的文字如何换行显示,例如显示成两行
- 怎样使DbGrid在没有数据的情况下默认显示10行???帮帮忙!!
- 如何查询日期型和逻辑型字段
- oracle 8.1.6中为什么Enterprice Manager Console进不去,急急急!!!
- 简单的图表显示,请帮忙看看啦
- 如何让一个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;