medium date

  • Thread starter Thread starter antonov
  • Start date Start date
A

antonov

hello everybody... I urgently need an answer to this question: I use the
now() fuction but I need it to write only in medium date format. All the
textboxes are formatted in medium date and also the table. But when I use
now() in the table everything is stored with
day-month-year-hours-minutes-seconds format
thanks
 
formatting has nothing to do with how a date/time value is stored in an
Access table. the value itself is actually a Number data type, Double. you
can apply any date and/or time format you choose to the value, including the
standard LongDate, MediumDate, and ShortDate formats provided in Access - as
well as custom formats that you enter manually into the Format property (of
controls in forms and reports).

hth
 
Now() includes the current time as well as the date. Try using Date()
instead. Just so the record is straight, a Date/Time field *always* includes
a time component!
 
The format of a date/time value is independent of the stored value. A
date/time value in Access is stored as a 64 bit floating point number as an
offset from 30 December 1899 00:00:00 with the integer part representing the
day and the fractional part the time of day. There is no such thing in
Access as date value per se; all have a time of day. If you enter a value
as a date the value is in fact midnight at the start of that date.
Conversely if you enter a value as a time of day the value stored is that
time on 30 December 1899. More correctly it’s the numeric representations of
those date/time values.

If you want the values stored in your table to be 'dates', i.e. date/time
values with a zero time of day, then use the Date() function not the Now()
function, the former returns a value of midnight at the start of the current
day, the latter a value of the current date and time of day.

If you need to convert existing values in your table to values with a zero
time of day you can do so with an update query along the following lines:

UPDATE [YourTable]
SET [YourDate] = DATEVALUE([YourDate])
WHERE [YourDate] IS NOT NULL;

Ken Sheridan
Stafford, England
 
Hello, in the Default Value of the textbox in question I've written this
=Format(Now(),"Medium Date") and it works

Thanks again for your patience and help
 
As you've been told repeatedly, you should use the Date function, not the
Now function, if all you want is the date, not the date and time.
 

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

Similar Threads


Back
Top