Re: Date vs DateTime values

Tech-Archive recommends: Fix windows errors by optimizing your registry



On 8 Nov 2006 20:27:28 -0800, "rpboll" <RPBOLL@xxxxxxxxx> wrote:

I appended some Date values into a table with a DateTime field. The
date values are short dates (i.e., 10/15/06)

I entered a few date stamps using the NOW() that include the present
date and the time.

When I execute this query:
=#1/1/2004# And <= #11/8/2006#
only the shortdates are returned. Any suggestions to include all dates
within the range regardless of whether it includes datestamps or not?
Thanks.

RPBoll

Just to add to Duane and Van's comments: a Date/Time value in Access
is stored as a double float number, a count of days and fractions of a
day (times) since midnight, December 30, 1899. As such ANY date/time
value has a time component - it may often be .0, corresponding to
midnight.

The format only controls how this numeric value is interpreted for
display, not what's stored. If you have 39029.9968171296 stored in
your table field, it corresponds to 11/8/2006 11:55:25 PM - or to
11/8, or to 11:55 PM, or to 23:55:25, or to 8 November 2006, depending
on how you choose to set the Format property of the control displaying
it.

Using Now() as you did to populate a field fills in the current system
clock time and date. If you don't want the time portion, use Date()
instead - it will still fill in a time, as it must, but that time will
be midnight at the start of the day.

To ensure that all date/time values (with or without a nonzero time
portion stored) are retrieved in a query use a criterion such as

= [Enter start date:] AND < DateAdd("d", 1, DateValue([Enter End Date:]))

to get the 24 hours past midnight of the user's entered date included.

John W. Vinson[MVP]
.



Relevant Pages

  • RE: time keeps converting itself to date!
    ... In the access database itself? ... check your Time column's Format property. ... Access stores all of it's Date/Time data as both date and time but then uses ... a Date value default the time portion to the minimum value. ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: time keeps converting itself to date!
    ... In the access database itself? ... check your Time column's Format property. ... Access stores all of it's Date/Time data as both date and time but then uses ... a Date value default the time portion to the minimum value. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: validating a date
    ... The text box would display the date/time ... > by specifying the format property or function. ...
    (microsoft.public.access.modulesdaovba)
  • Re: date/time data type
    ... A date/time value always includes both a date and a time portion. ... > I'm having is access is creating a time for the entry on ... > the database entry or prevent Access from creating a time ...
    (microsoft.public.access.tablesdbdesign)
  • Re: use Format code to display "-" for 12:00
    ... If this is a continuous form, you will want to put this in the recordset ... instead of a calculated control ... since Date/Time is actually stored as a number, ... use the Format property of that actual date/time control ...
    (microsoft.public.access.reports)