Convert "Date Format" and into "Text"

  • Follow


I have a query like this:
--------------------------------------------------------------------------------
SELECT Name, B_Day,
FROM people
--------------------------------------------------------------------------------
my "B_Day" output looks like this:
12/4/1985
12/4/1995
--------------------------------------------------------------------------------
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 ! ^_^!


-- 
Allen Phailat Wongakanit
0
Reply Utf 12/27/2007 9:09:00 AM

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.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"ali" <ali@discussions.microsoft.com> wrote in message 
news:8DD9FA46-BA4D-477E-BF19-3BA5103CD826@microsoft.com...
>I have a query like this:
> --------------------------------------------------------------------------------
> SELECT Name, B_Day,
> FROM people
> --------------------------------------------------------------------------------
> my "B_Day" output looks like this:
> 12/4/1985
> 12/4/1995
> --------------------------------------------------------------------------------
> 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 ! ^_^!
>
>
> -- 
> Allen Phailat Wongakanit 


0
Reply Douglas 12/27/2007 1:03:33 PM


1 Replies
752 Views

(page loaded in 0.035 seconds)

Similiar Articles:
















7/18/2012 7:39:42 AM


Reply: