Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2006, 05:50 PM
Registered User
 
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting date to yy.mm.dd format using CONVERT

I am able to get the date, but I don't know how to convert the date to the yy.mm.dd using CONVERT.

Thanks

 
Old October 14th, 2006, 05:57 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

CONVERT(date, 102)

Look up CAST and CONVERT in the BOL. But the above should give you what you need.

Scott Klein
Author - Professional SQL Server 2005 XML
http://www.wrox.com/WileyCDA/WroxTit...764597922.html
 
Old October 14th, 2006, 06:01 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Sorry, that's:

CONVERT(datetime, date, 102)

For example:

SELECT CONVERT(datetime, GETDATE(), 102)

Scott Klein
Author - Professional SQL Server 2005 XML
http://www.wrox.com/WileyCDA/WroxTit...764597922.html
 
Old October 14th, 2006, 06:02 PM
Registered User
 
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've look up BOL (took me a bit to realize was BOL meant :)) and saw the chart showing 2 or 102 but I can't figure out how to incorporate it with my GETDATE(). What I want to do is convert today's date to yy.mm.dd.

Thanks, Jinn

 
Old October 14th, 2006, 06:03 PM
Registered User
 
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

:D Thanks :D

 
Old October 14th, 2006, 06:07 PM
Registered User
 
Join Date: Oct 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

SELECT CONVERT (varchar (15), GETDATE(), 102)

WOOHOO! This is waht I needed. Thank you for pointing me in the right direction!

 
Old October 14th, 2006, 06:44 PM
SQLScott's Avatar
Wrox Author
 
Join Date: Dec 2004
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Glad i could help.

Scott Klein
Author - Professional SQL Server 2005 XML
http://www.wrox.com/WileyCDA/WroxTit...764597922.html





Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing date in dd/mm/yyy format mike_remember ASP.NET 2.0 Professional 1 May 13th, 2008 04:23 AM
Display date as mm-dd-yy (without century) elygp ASP.NET 1.0 and 1.1 Professional 1 May 9th, 2007 03:21 AM
Converting short date to show mm/dd/yyyy crabjoe Access 4 March 7th, 2007 03:46 AM
Convert date String (dd/mm/yy) to dd- Month- yy minhpx J2EE 2 March 6th, 2007 08:29 AM
Converting a date format to dd-Mon-yyyy cole SQL Server 2000 4 January 25th, 2006 12:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.