Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

datetime

how can i make sure the entered datetime is a valid datetime through a grid
0
palabros
Asked:
palabros
1 Solution
 
Lee_NoverCommented:
try it :)


function ValidateDT(const DateTime: string; var DT: TDateTime): Boolean;
begin
  try
    DT:=StrToDateTime(DateTime);
    Result:=true;
  except
    DT:=0.0;
    Result:=false;
  end;
end;
0
 
ITugayCommented:
Hi palabros,


use OnSetEditText event to check typed by user data.

-----
Igor.
0
 
nestoruaCommented:
HI,
You can use TDateTimePicker to give the user to choose the date instead of entering it.
Sincerely,
Nestorua.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
palabrosAuthor Commented:
hi nestorua
Can i use a datetimepicker in a grid .again as my datetime is keyfield i am having some trouble with findkey.
can anybody tell me how can we pass datetime field to findkey so as to check for duplication.
i am facing a problem such that 04/10/92 and 10/04/92 are
seems to be fetching the same results.
in which way am i supposed to proceed.

hi lee nover
thanks for the code but this code i have to use i before post events and i am having hell of trouble with handling
events as i really find it difficult to study the sequence of its occurence.
thanks
jon
0
 
nestoruaCommented:
HI,
TDateTimePicker will be appear ONLY when you try to edit that
Field of type TDateTime.
So it will not effect (impact) on your searching.
As for 04/10/92 and 10/04/92: if those values are in the Field of type TDateTime then they are different (April and October).
So, to my mind you should not consider them as the same.
Sincerely,
Nestorua.
0
 
palabrosAuthor Commented:
hi nestorua ,i have finally reached on to a solution of editmask. and now things r working fine
thanks for u r comments
0
 
nestoruaCommented:
HI,
You are welcome, glad my help was useful.
Sincerely,
Nestorua.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now