Search code examples
ms-accessdate

MS Access Date problem , how to compare date


I would like to compare 2 date, which stored in database as String.
When I compare the date, I must convert them to date first, right? I know the ms access function datevalue() would convert a string to a date, but I am not sure what it will return, in other words, I don't know how access treats different parts of a string date.

For example, when I pass "11/12/2010" to datevalue, I would expect a date meaning Dec 11, 2010. And when I pass "12/11/2010", I also want to make sure it turns out to be Dec 22, 2010 so that my calculation works. I don't want ms access to interpret it as Nov, 12, 2010.

Ms access' datevalue() function doesn't need me to give any extra information about this.

Please give me some clues, thanks.


Solution

  • From DateValue Function (Archived):

    If date is a string that includes only numbers separated by valid date separators, DateValue recognizes the order for month, day, and year according to the Short Date format you specified for your system.