how to get just mm-dd-yy when setting default value as =Date()

  • Thread starter Thread starter Gary G
  • Start date Start date
G

Gary G

I set default value as =Date(). How to get rid or the time appearing after
month, day, year

GG
 
Assuming this is happening in a text box, try changing the format of the
text box to Medium Date or mm-dd-yy.
 
I set default value as =Date(). How to get rid or the time appearing after
month, day, year

GG

Don't confuse data STORAGE with data PRESENTATION. Dates are stored as a
number, a count of days and fractions of a day (times) since midnight,
December 30, 1899; as such all Date/Time fields have a time portion. This will
be .000000 (equivalent to midnight) if you use Date().

You can choose not to display it by setting the Format property of your table
field, or form or report textbox, to either Short Date (which will use the
Short Date format specified in your Windows Start... Control Panel...
Regional... Date And Time settings; or explicitly to "mm-dd-yy" if you prefer.
 
It is only a problem when I move to the field on a form. The field name is
called "DateUpdated" It is defined in the table as a short date value.I want
to change that value to Now() when I click on the field on the form so I did
this under properties..event--on click =Now(). This works ok, but when I
mouse to that field on my form, the time appears after the month,day,year.
Setting the format to short date for that form field does not remedy this.
Seems like I need some sort of "got focus" format?
 
It is only a problem when I move to the field on a form. The field name is
called "DateUpdated" It is defined in the table as a short date value.I want
to change that value to Now() when I click on the field on the form so I did
this under properties..event--on click =Now(). This works ok, but when I
mouse to that field on my form, the time appears after the month,day,year.
Setting the format to short date for that form field does not remedy this.
Seems like I need some sort of "got focus" format?

Now() returns the current date and time, to the second. If you just want the
date, don't use Now(), use Date() instead.

And it would have helped a bit if you had explained this in your original
post, which only mentioned that you had a Default Value property of Date().
Not the same thing!
 
John, Thx for the reply. Date() also results in a time after the date, after
I set the mouse pointer to focus on the field and properties..set event to
click on = Date()
 
John, Thx for the reply. Date() also results in a time after the date, after
I set the mouse pointer to focus on the field and properties..set event to
click on = Date()

It results in a time portion of 00:00:00. As noted in my original reply, a
Date/Time value *ALWAYS* has a time portion. You can't "not have" a time; all
you can do is suppress its display.

If you're getting a time other than midnight (00:00:00) please post your
actual code.
 
It is only a problem when I move to the field on a form. The field name
is called "DateUpdated" It is defined in the table as a short date
value.I want to change that value to Now() when I click on the field on
the form so I did this under properties..event--on click =Now(). This
works ok, but when I mouse to that field on my form, the time appears
after the month,day,year. Setting the format to short date for that form
field does not remedy this. Seems like I need some sort of "got focus"
format?

Format only affects the appearance when the field/control does not have
focus. To control the appearance when it HAS focus you have to use an
InputMask (yuck).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top