Solved

datetime

Posted on 2002-05-23
7
339 Views
Last Modified: 2010-04-04
how can i make sure the entered datetime is a valid datetime through a grid
0
Comment
Question by:palabros
7 Comments
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7029715
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
 
LVL 9

Expert Comment

by:ITugay
ID: 7031394
Hi palabros,


use OnSetEditText event to check typed by user data.

-----
Igor.
0
 
LVL 4

Expert Comment

by:nestorua
ID: 7033216
HI,
You can use TDateTimePicker to give the user to choose the date instead of entering it.
Sincerely,
Nestorua.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:palabros
ID: 7033999
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
 
LVL 4

Accepted Solution

by:
nestorua earned 50 total points
ID: 7034181
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
 

Author Comment

by:palabros
ID: 7038982
hi nestorua ,i have finally reached on to a solution of editmask. and now things r working fine
thanks for u r comments
0
 
LVL 4

Expert Comment

by:nestorua
ID: 7039040
HI,
You are welcome, glad my help was useful.
Sincerely,
Nestorua.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now