Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Microsoft SQL Server Management Studio Express - datetime Expand / Collapse
Author
Message
Posted Sunday, October 28, 2007 11:14 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 2, 2007 10:13 AM
Points: 2, Visits: 4
How do I make Microsoft SQL Server Management Studio Express display Datetime variables in a table in the format of my choice ( when viewing those timedate variables on Studio Express)

Currently they display as nn/dd/yy hh:mm:ss AM/PM

I would much prefere to see them as yyyy/nn/dd HH:mm:ss

( I appreciate they are stored ion the database as Timedate (double integer) -- I am talking aboit how the application STudio Express choses for format the date & time when it displays the values in the tables)

Post #415793
Posted Sunday, October 28, 2007 1:43 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, January 29, 2015 3:06 AM
Points: 416, Visits: 574
You can convert current date as you required by below piece of code


select convert(varchar(25),getdate(),101)

You can change the last variable value from 101 to 121 and each value represent one datetime format


Regards..Vidhya Sagar
SQL-Articles
Post #415798
Posted Sunday, October 28, 2007 1:56 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, January 29, 2015 3:06 AM
Points: 416, Visits: 574
Refer the below link for more on the topic
http://www.databasejournal.com/features/mssql/article.php/10894_2197931_1


Regards..Vidhya Sagar
SQL-Articles
Post #415803
Posted Monday, October 29, 2007 8:54 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 2, 2007 10:13 AM
Points: 2, Visits: 4
vidhya sagar (10/28/2007)
You can convert current date as you required by below piece of code


select convert(varchar(25),getdate(),101)

You can change the last variable value from 101 to 121 and each value represent one datetime format


Thanks for the reply, but you may have missed the point of the question.

How do I get "Microsoft SQL Server Manager Studio Express" to display "datetime" variables in the format of my choice.
Ideally for any database and any table I use the application for.

One would assume that there was a Preference settting somewhere to control how the application displays a "datetime" variable. ???

However, if you have given me the answer, I must admit I am a SQL novice, and therefore do not know how to apply your answer to the "Studio Express" application. :)
Post #416052
Posted Thursday, December 13, 2007 2:19 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, April 29, 2015 1:39 AM
Points: 46, Visits: 130
I will try to naswer to your question.

You wrote:

Thanks for the reply, but you may have missed the point of the question.

How do I get "Microsoft SQL Server Manager Studio Express" to display "datetime" variables in the format of my choice.
Ideally for any database and any table I use the application for.

One would assume that there was a Preference settting somewhere to control how the application displays a "datetime" variable. ???


Try this:

1. Open Microsoft SQL Server Manager Studio Express, and connect to your SQL Server.

2. Find New Query label on the top-left side of SQL Server Management Studio.

Simply type:

SELECT convert(varchar(25) getdate(), 101)

and click EXECUTE button.

This will make SQL Server to display your date/time format as you wish. You could change number 101 by others between 101 and 125.

Hope that this will help
Post #432711
Posted Wednesday, March 4, 2015 1:17 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, March 4, 2015 4:08 PM
Points: 1, Visits: 1
Impressively, you STILL didn't get the point!

The question is about how to CONFIGURE an application (i. e. MS SQL Server Management Studio) to display datetime values BY DEFAULT (i. e. without modiying the query by applying CONVERT etc.) in a certain format.

Maybe you want another shot at it
Post #1665676
Posted Wednesday, March 4, 2015 2:07 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, May 22, 2015 6:46 AM
Points: 478, Visits: 1,144
I understood your question and AFAIK the answer is NO. Check for yourself under Tools-->Options... You'll find several options for formatting the results of a SQL query. Unfortunately, date formatting doesn't appear to be one of them.

Sigerson

"No pressure, no diamonds." - Thomas Carlyle
Post #1665701
Posted Wednesday, March 4, 2015 2:10 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, May 22, 2015 6:46 AM
Points: 478, Visits: 1,144
Alternatively you could design your date fields as VARCHAR(10) and format them any way you wish. Of course that would completely negate the extreme usefulness of the DATETIME type and would be a very poor design choice. DATETIME and SMALLDATETIME exist as they are for very good reasons.

Sigerson

"No pressure, no diamonds." - Thomas Carlyle
Post #1665702
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse