Skip to content Skip to sidebar Skip to footer

Sql-only Find Time And Not Date In Access Date/time Field

In an Access database table some Date/Time data has corrupted and now only shows a time e.g. 15:15. Is there any SQL that will allow me to select records which only have the time d

Solution 1:

Access does not have separate Date and Time column (field) types, so it does two things to "help" users work with "dates" and "times":

  1. Date/Time values where the time is exactly midnight will by default be displayed as just the date.

  2. Date/Time values where the date part is 1899-12-30 will by default be displayed as just the time.

In these special cases the full Date/Time information can be displayed by specifically formatting the value (using the .Format properties of fields or controls, or by using the Format() function).

So, to select Date/Time values that look like they only contain times you would do

SELECT datetimevalue
FROM tablename
WHERE datetimevalue >= #1899-12-30# AND datetimevalue < #1899-12-31#

Post a Comment for "Sql-only Find Time And Not Date In Access Date/time Field"