Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to convert date field to format mmddyyyy

Status
Not open for further replies.

tmartin99

MIS
Joined
Sep 14, 2001
Messages
9
Location
US
I have a date field in a SQL 2000 table that I need to output in the format mmddyyyy and can't seem to find a function to do it?
 

Use a combination of functions.

Select Replace(Convert(char(10),DateCol,101),'/','')

Convert gives mm/dd/yyyy (style 101)
Replace removes the / by replacing it with an empty string. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
thanks so much, I'm new to SQL Server, you can do the same function in Oracle using to_char(datefield,'mmddyyyy')
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top