Solved

TDateTime and Edit Masks

Posted on 1998-03-26
4
605 Views
Last Modified: 2010-04-06
I have a field in a Tquery defined as TDateTime (from an Oracle Date column), and all I want to do is allow the user to modify the date portion.  I have a display format of 'm/d/yy', which is fine.  I put a edit mask of '!99/99/00;1;_' which doesn't work the way I want it to.

For example:  When I cursor to that TDBEdit field it changes from 3/20/98 to _3/20/AM and I can't edit it correctly.  Any ideas on what to do?

NOTE:  If the date field has NO time (0) it works fine.
0
Comment
Question by:gjbaker
4 Comments
 

Expert Comment

by:BigMadDrongo
ID: 1360919
The underscore specified at the end of the edit mask is that character shown in empty characters in the masked edit box, and that is why if you omit then first character in the month field, it will replace it with the underscore.  The only way round this that I'm aware of is to enter the date as 03/20/98.  I personally don't like the masked edit boxes because of this limitation.  Hope this info is useful!
0
 

Author Comment

by:gjbaker
ID: 1360920
I don't have a problem with the underscore, but why does AM show up where the year is suppose to?  It's even worse if I want the year to be four digits.
0
 
LVL 1

Expert Comment

by:Greedy
ID: 1360921
I was going to answer the question but I figured this might just be a work around so I'll put it as a comment

in the OnEnter event of the DBEdit do this
DBEdit.Text := FormatDateTime('MM/DD/YYYY', DBEdit.Field.Value)

that should at least do what you need...some person I work with mentioned this too...I don't know if they fixed it or went with something else...
0
 
LVL 1

Accepted Solution

by:
jturpin earned 50 total points
ID: 1360922
The uderscore in the edit mask is the character used
to fill the spaces. Simply edit the edit mask and replace
the underscore with a space.
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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

16 Experts available now in Live!

Get 1:1 Help Now