Solved

convert date column to mmddyyyy format

Posted on 2008-10-17
2
476 Views
Last Modified: 2012-05-05
Trying to convert a date column so that output is in the form of mmddyyyy.

I am doing :
rtrim(convert(char,datepart(mm,Citations.dob)))+
rtrim(convert(char,datepart(dd,Citations.dob)))+
rtrim(convert(char,datepart(year,Citations.dob)))

However output is 912008 - it is getting rid of the leading zero in the month and day
0
Comment
Question by:jbeckstrom
2 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 125 total points
Comment Utility
select replace(convert(varchar(10), datefield, 101), '/', '')
0
 

Author Closing Comment

by:jbeckstrom
Comment Utility
That did it.  Thanks.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now