You can do that with the Format function. However, if your purpose is to
extract a part of the date, you can do that in a more locale-independent way
using the various functions designed for that purpose, such as Year(),
Month(), Day(), etc.
Here's an example that on my system (where short date format includes
four-digit years) returns the same value in both columns (albeit one is a
string and the other is an integer). The first column might return a
different result on another system, the second column would not ...
SELECT Right$(Format$([OrderDate],"Short Date"),4) AS StringDate,
Year([OrderDate]) AS OrderYear
FROM db
rders;
--
Brendan Reynolds (MVP)
Frank Xia said:
How to convert date/time to string in query? So I can handle it with using
"Left" or "Right" function.
Thanks for any help in advance!