Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8399837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:24:41+00:00 2026-06-09T21:24:41+00:00

I have a table where I select customer purchase activity and it will display

  • 0

I have a table where I select customer purchase activity and it will display the date of purchase (along with the time) in ColumnA, in this format:

2012-08-06 10:06:42.223
YYYY-MM-DD HH:MM:SS

I want to display the date only, so I added a LEFT function like so:

LEFT(ColumnA, 11)

This will get rid of the time but now the date is displayed I will get:

Aug  06 2012

I want to display it in numeric format but as MM/DD/YYYY so it will look like:

08/06/2012
MM/DD/YYYY

Any ideas how I can do this in T-SQL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:24:42+00:00Added an answer on June 9, 2026 at 9:24 pm

    You just need to convert it:

    SELECT convert(char(10), getdate(), 101)
    

    or from your table:

    SELECT convert(char(10), yourDate, 101)
    FROM yourTable
    

    Here is a handy website with the conversions:

    How to format datetime & date in Sql Server 2005

    Or if you just want yourDate value without the time, you can always use which results in 2012-08-06 00:00:00.000:

    declare @yourDate datetime
    set @yourdate = '2012-08-06 10:06:42.223'
    
    select DateAdd(day, DateDiff(day, 0, @yourdate), 0)
    

    Or from yourTable:

    select DateAdd(day, DateDiff(day, 0, yourDateField), 0)
    from yourTable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table. In this table have select element. How can I find
I have a table orders like this: customer_id order_date 10 2012-01-01 11 2012-01-02 10
I have the following table Select * from Peeps Id Name Age 1 Sam
I have Table A. How can I select from Table A to get Table
i have users table and i have posts table i want select from users
I have a testdata like this: DROP TABLE SELECT_PASS; CREATE TABLE SELECT_PASS(ID INT(20),TESTCASE VARCHAR(20),RESULT
I have table with 3 columns A B C. I want to select *
suppose I have SELECT * FROM table t GROUP BY j HAVING condition_one OR
I have users table and want to SELECT some rows by bitmask criteria. I'll
I have a table structured as following: I'm trying to select the latest handicap

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.