I am trying to get specific record by comparing date string. Here is the table
UpdateTimeA - UpdateUserId
----------------------------------------
2015/09/02 14:39:39 - User1
2015/09/02 16:57:29 - User2
2015/09/02 16:58:37 - User3
And here is the query
SELECT UpdateUserId, UpdateTimeA From SubmitSheets
WHERE UpdateTimeA =DateValue('9/2/2015 4:58:37 PM')
This query returns 0 records UpdateTimeA is a DateTime
type field.
No need to use Format:
SELECT UpdateUserId, UpdateTimeA
From SubmitSheets
WHERE UpdateTimeA = #9/2/2015 4:58:37 PM#
Or you can use the serial functions:
SELECT UpdateUserId, UpdateTimeA
From SubmitSheets
WHERE UpdateTimeA = DateSerial(2015, 9, 2) + TimeSerial(16, 58, 37)
Please try to use something like this:
SELECT UpdateUserId, UpdateTimeA
From SubmitSheets
WHERE Format(UpdateTimeA, "m/d/yyyy hh:nn:ss AM/PM") = '9/2/2015 4:58:37 PM'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.