From: shil on
Hi all,

When I execute a SQL query to display values from a table, the date
format is being displayed as "2009-06-07 00:00:00". But I would like
it to display as "6/7/2009 12:00:00 AM".
Is there any setting in the Management Studio I need to set?
My laptop's Language is set to "English (United States)" in the
Regional and Language Settings.

Thanks.
From: Justin Rich on
http://msdn.microsoft.com/en-us/library/ms189491.aspx

"shil" <joshilat(a)gmail.com> wrote in message
news:55e20148-7291-48f0-964c-ce5107bcde86(a)s6g2000vbp.googlegroups.com...
> Hi all,
>
> When I execute a SQL query to display values from a table, the date
> format is being displayed as "2009-06-07 00:00:00". But I would like
> it to display as "6/7/2009 12:00:00 AM".
> Is there any setting in the Management Studio I need to set?
> My laptop's Language is set to "English (United States)" in the
> Regional and Language Settings.
>
> Thanks.

From: Aaron Bertrand on
You need to change your query using CONVERT or .

PS wanting it to show m/d/y is bad. Someone from England using your machine
will think that is July 6th, not June 7th. At least YMD is unambiguous.


On 10/7/09 2:41 PM, in article
55e20148-7291-48f0-964c-ce5107bcde86(a)s6g2000vbp.googlegroups.com, "shil"
<joshilat(a)gmail.com> wrote:

> Hi all,
>
> When I execute a SQL query to display values from a table, the date
> format is being displayed as "2009-06-07 00:00:00". But I would like
> it to display as "6/7/2009 12:00:00 AM".
> Is there any setting in the Management Studio I need to set?
> My laptop's Language is set to "English (United States)" in the
> Regional and Language Settings.
>
> Thanks.

From: Aaron Bertrand on
I'm not sure how SET DATEFORMAT helps.


SET DATEFORMAT DMY;
SELECT GETDATE();
SET DATEFORMAT MDY;
SELECT GETDATE();


results:


-----------------------
2009-10-07 15:14:17.917


-----------------------
2009-10-07 15:14:17.917




On 10/7/09 2:50 PM, in article
8DA8B249-355A-40C3-9DC6-0693AC7C77A8(a)microsoft.com, "Justin Rich"
<jrich523(a)yahoo.spam> wrote:

> http://msdn.microsoft.com/en-us/library/ms189491.aspx
>
> "shil" <joshilat(a)gmail.com> wrote in message
> news:55e20148-7291-48f0-964c-ce5107bcde86(a)s6g2000vbp.googlegroups.com...
>> Hi all,
>>
>> When I execute a SQL query to display values from a table, the date
>> format is being displayed as "2009-06-07 00:00:00". But I would like
>> it to display as "6/7/2009 12:00:00 AM".
>> Is there any setting in the Management Studio I need to set?
>> My laptop's Language is set to "English (United States)" in the
>> Regional and Language Settings.
>>
>> Thanks.
>

From: Justin Rich on
maybe its 08 only, not sure. but according to the docs it should do it.

"Aaron Bertrand" <moc.liamg(a)dnartreb.noraa> wrote in message
news:C6F260DB.2591C%moc.liamg(a)dnartreb.noraa...
> I'm not sure how SET DATEFORMAT helps.
>
>
> SET DATEFORMAT DMY;
> SELECT GETDATE();
> SET DATEFORMAT MDY;
> SELECT GETDATE();
>
>
> results:
>
>
> -----------------------
> 2009-10-07 15:14:17.917
>
>
> -----------------------
> 2009-10-07 15:14:17.917
>
>
>
>
> On 10/7/09 2:50 PM, in article
> 8DA8B249-355A-40C3-9DC6-0693AC7C77A8(a)microsoft.com, "Justin Rich"
> <jrich523(a)yahoo.spam> wrote:
>
>> http://msdn.microsoft.com/en-us/library/ms189491.aspx
>>
>> "shil" <joshilat(a)gmail.com> wrote in message
>> news:55e20148-7291-48f0-964c-ce5107bcde86(a)s6g2000vbp.googlegroups.com...
>>> Hi all,
>>>
>>> When I execute a SQL query to display values from a table, the date
>>> format is being displayed as "2009-06-07 00:00:00". But I would like
>>> it to display as "6/7/2009 12:00:00 AM".
>>> Is there any setting in the Management Studio I need to set?
>>> My laptop's Language is set to "English (United States)" in the
>>> Regional and Language Settings.
>>>
>>> Thanks.
>>
>