Convert "Date Format" and into "Text"

  • Thread starter Thread starter ali
  • Start date Start date
A

ali

I have a query like this
--------------------------------------------------------------------------------
SELECT Name, B_Day,
FROM peopl
--------------------------------------------------------------------------------
my "B_Day" output looks like this:
12/4/1985
12/4/199
--------------------------------------------------------------------------------
I would like the output to be "yyyy-mm-dd" (1985-4-12), and

I would like it to be "text".

Thanks a lot , experts ! ^_^!
 
What's the data type of B_Day: Text or Date?

If it's Text, try:

SELECT [Name], Format(CDate([B_Day]), "yyyy\-mm\-dd") AS BDay
FROM people

If it's Text, try:

SELECT [Name], Format([B_Day], "yyyy\-mm\-dd") AS BDay
FROM people

Note that you should rename the Name field to something else: Name is a
reserved word, and should never be used for your own purposes. (For a good
discussion of names to avoid, see what Allen Browne has at
http://www.allenbrowne.com/AppIssueBadWord.html). If you cannot, or will
not, rename the field, at least put square brackets around it, as in my
example.
 
Back
Top