Solved

DateTime Conversion

Posted on 2013-01-16
3
230 Views
Last Modified: 2013-01-16
How do I conver a DateTime date field to display only the date.
Example:
SELECT Customer,Invoice,InvoiceDate
From Invoices
Where
Customer = 123

Normal Results:
123    45678    2012-10-222 11:15:03:00

What I need
123    45678    2012-10-222
0
Comment
Question by:PhilChapmanJr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 500 total points
ID: 38782430
SELECT Customer,Invoice,convert(nvarchar(10), InvoiceDate, 120) as InvoiceDate
From Invoices
Where
Customer = 123
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 38782445
please read up this article:
http://www.experts-exchange.com/Database/Miscellaneous/A_1499-DATE-and-TIME-don%27t-be-scared-and-do-it-right-the-first-time.html
above comment is correct, in that regards...
I presume the 222 (day) is a typo
0
 
LVL 2

Author Closing Comment

by:PhilChapmanJr
ID: 38782487
Thanks
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MSSQL Query for Selecting the SUM of a Specific Group 2 37
Sorting a SQL script 5 41
Question about Common Table Expressions 3 45
SQL Server Agent "Access Denied" Error 3 36
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

739 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