• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • Last Modified:

SQL date formatting

Hello all,
I have a date time column DispensedDate which has values like :2012-06-07 00:00:00.000.
How to convert this to MM/DD/YY in a query
0
Star79
Asked:
Star79
2 Solutions
 
Guru JiCommented:
SELECT convert(varchar, getdate(), 101) – mm/dd/yyyy - 10/02/2008
0
 
Guru JiCommented:
replace getdate() with your date column
0
 
AverittegCommented:
Try:
SELECT CAST(table.DispensedDate AS DATE) AS DispensedDate
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Star79Author Commented:
hello all,
I need it like
MM/DD/YY
Note the year its only YY
0
 
tim_csCommented:
Replace his 101 with just 1.
0
 
AverittegCommented:
Select CONVERT(VARCHAR(11),DispensedDate,1) as Dispensed Date from table

Tim_cs was correct: this version works just fine in a sql query. Tested success in Sql 2008.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now