Well, you can't turn off the field validation on a date field that insists on month, day, year delimitters such as the /.
You could set it up with a text field for entering the date and a date field that uses the contents of your text field to auto-enter a date computed from your text field.
I made this work as an experiment:
two fields: aDatetxt, aDate
In the text field aDatetxt, I used this as my auto-enter calc:
If (Length(Self) = 8; Date(Left(Self;2); Middle(Self; 3; 2) ; Right(Self; 4 ) ) )
This changes 01012010 to 1/1/2010 and gives you immediate feedback as to how your date got reformatted.
in aDate, I used:
In both fields, I cleared the "Do not replace..." option in the auto-enter tab of their field options.
I'll give it a go when I get home.
Thanks so much!
Would it not return "01/01/2010"? I store my dates that way. Or would it leave out the leading zeroes?
My tests show no leading zeroes--though I can format the date field to display them if I want.
I could alter the calculation to do straight text manipulation instead of using the date function and then you'd get leading zeroes...
If (Length(Self) = 8; Left(Self;2) & "/" & Middle(Self; 3; 2) & "/" & Right(Self; 4 ) )
The only reason I didn't use this in my original example is that I was first experimenting to see if I could get a date field to perform the auto-enter without needing the text field. When that didn't work, I converted it to text and added the second field--plus invalid characters result in ? appearing in both fields which is a very crude bit of error checking.
As I suspected then; the "Date" function strips leading zeroes. Since I concatenate dates with other data and this field is later used in calcs involving "Left", "Right" etc. I tend to wrap the date elements in a zero padding function just in case someone (me) mis-enters the date.
Thanks ( I should have tested before asking),
As I suspected then; the "Date" function strips leading zeroes.
The Date() function returns the calculated date in the format being used by the file. If that format includes leading zeros, then so will the result.