A date is a string; you don't need to convert it. You can perform string functions such as Left$, Mid$, etc. on the date with "converting" it. Formatting only changes the way the data is displayed, not how it's stored.
Dates are stored as numeric values in Access. You can use string functions on dates because Access implicitly converts dates to strings when needed. Dates are converted to strings based on the computer's settings. One PC may return today's date as 9/22/01, another as 09/22/2001 and yet another as 2001-09-22 and so forth.
CStr will convert a date to a string but does so according to the PC settings. Format(DateCol) without any formatting parameters also returns a string that is formatted according to the PC's settings.
In order to properly perform string manipulations on dates, the programmer should explicitly format dates. Of course, if all you want is a string and will not be manipulating the string with mid, left, right, etc. then any of these conversion methods will work. Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.