Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Script to return datetime as just date

By Paul Hickman, 2005/02/18

You can return the date as a string (varchar) in whatever date format you like by adding a 'style' to the CONVERT statement. Exmaples of style values are (two left hand columns):
1 101 USA mm/dd/yy
2 102 ANSI yy.mm.dd
3 103 British/French dd/mm/yy
4 104 German dd.mm.yy
5 105 Italian dd-mm-yy
6 106 - dd mon yy

The three-digit styles give you four-figure year values. Look up 'CAST and CONVERT' in SQL Server books for more configurations

From Paul Hickman
SCA Computing Ltd, Lyndhurst, UK

Total article views: 175 | Views in the last 30 days: 3
 
Related Articles
FORUM
FORUM

style cop for t-sql

style cop for t-sql

FORUM

style cop for t-sql

style cop for t-sql

BLOG

Presentation Styles

I had a chance to watch a few different styles this week at TechEd, and I think it helped that...

FORUM

cascading style sheets

how to add cascading style sheets

Tags
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones