?
Solved

date field

Posted on 2002-07-18
15
Medium Priority
?
258 Views
Last Modified: 2010-04-04
I am using a dbedit for a date entry but I always get an error message that the date entered is not a valid date though it is a date. There must be something I need to declare or configure. Can somebody help me on how to handle a date field? Thanks
0
Comment
Question by:sharol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +5
15 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 400 total points
ID: 7161676
use the ongettext/onsettext events of the field

in this events use a conversion like

--ongettext
text := Field.AsString;

--onsettext
field.AsDateTime := StrToDate(text);

just from head

meikl ;-)
0
 
LVL 3

Expert Comment

by:LukA_YJK
ID: 7161687
Maybe you actually enter invalid dates. For example you enter '/' as separator, but it is '.' or you enter [month,day,year], but it must be [day,month,year]. To find all these info launch BDE Administrator and look at Configuration-System-Formats-Date. Hope it will be helpful...
0
 

Author Comment

by:sharol
ID: 7164059
Kretzschmar, I cant find the ongettext and onsettext event in the dbedit field. Are you talking anout a TDBEdit component? I cant fine the events you mentioned. Hope you could help me on this.

LukA YJK, I checked the BDE configuration and it is the way you described it to be. Is tehre anything else I can try?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 7164073
>Are you talking anout a TDBEdit component?
no, i talk about the underlying tfield

-doubleclick on your dataset-object
-rightclick on the the fieldseditor
-select add all fields
-select your datefield
-assign the events in the object-inspedtor

meikl ;-)
0
 

Author Comment

by:sharol
ID: 7169888
sorry, but Im not very good in Delphi yet(just starting...). how do i assign the event? thanks.
0
 
LVL 4

Expert Comment

by:jsweby
ID: 7172831
Another common cause of the "Invalid Date/Time" error is the fact that you are entering a date in a format different to that set up in your

Control Panel --> Regional Settings --> Date

settings. This specifies the separator and the date format.

J.
0
 

Expert Comment

by:RayNorrish
ID: 7178645
Get the very usefull RXTools from (ex. http://www.torry.net/huge.htm) and drop a TDateEdit on the form.
0
 

Expert Comment

by:RayNorrish
ID: 7178648
I mean a TDBDateEdit :)
0
 

Author Comment

by:sharol
ID: 7183192
How do I use it. Pardon but Im not really good at this yet. Thanks.
0
 

Expert Comment

by:RayNorrish
ID: 7184671
You just need to drop it onto the form, there is no real difference, there is a calendar button with it which can be switched off. It is really very easy to implement.
0
 

Author Comment

by:sharol
ID: 7190079
Sorry again. So, I have downloaded the tool. What do I do next, install it as new component?
0
 

Expert Comment

by:RayNorrish
ID: 7190184
There is a readme.txt that details how to install the package(s).

You must compile the runtime packages for your version of Delphi, and place the bpl files in your search path. Then you must compile and install the design time packages.

If you don't have the install instructions, then look at this example for installing into D5..

1. Delphi 5.x:


Use "File\Open..." menu item of Delphi IDE to open RX' runtime
package RXCTL5.DPK. In "Package..." window click "Compile" button to
compile packages RXCTL5.DPK. After compiling repeat that for other RX
Library run-time packages RXDB5.DPK, RXBDE5.DPK. Put compiled BPL files
into directory that is accessible through the search PATH (i.e. DOS
"PATH" environment variable; for example, in the Windows\System directory).
After compiling RX run-time packages you must install RX design-time
packages into the IDE.

RXCTL5.DPK RXDB5.DPK RXBDE5.DPK
RXCTL5.BPL, RXDB5.BPL, RXBDE5.BPL

Use "File\Open..." menu item to open RX design-time package DCLRX5.DPK.
In "Package..." window click "Compile" button to compile the package
and then click "Install" button to register RX Library components on
the component palette. Repeat that for other RX Library design-time
packages DCLRXDB5.DPK and DCLRXBD5.DPK.
0
 
LVL 2

Expert Comment

by:ferhad
ID: 7211953
Use Simple EditBox (not dbEdit) and type this code:

Table1.FieldByName('Date').AsString:=Edit1.Text;

Time format is Day,Month,Year

Hope it will help
Regards Ferhad
0
 

Expert Comment

by:CleanupPing
ID: 9343039
sharol:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 5

Expert Comment

by:Lukasz Lach
ID: 9461258
sharol,
No comment has been added lately (18 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to kretzschmar http:#7161676

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

anAKiN
EE Cleanup Volunteer
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 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