Solved

Convert dateTime to Date output

Posted on 2014-01-16
3
337 Views
Last Modified: 2014-01-16
I have a field in a datetime format.  When I do an insert into an existing table with a date field, I want the format to be 'MM/DD/YYYY'

I have the following statement:

convert(date,LastBilledDateTime,101) as LBDT.

When I look at the output the format is YYYY-MM-DD.

How can force it be MM-DD-YYYY?  The LastBilledDateTime is stored as DateTime.

Thanks

Glen
0
Comment
Question by:GPSPOW
[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
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 39787332
A datetime field does NOT store information "in a format". Datetime information is stored as numbers to minimize storage and easily facilitate date arithmetic.

It is a human need to see date in a specific format (and this is affected by culture you want MM/DD/YYYY whereas I would much prefer DD/MM/YYYY).
0
 

Author Closing Comment

by:GPSPOW
ID: 39787338
I see that now.  

Thanks

glen
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 39787411
no problem, you might find this page by Tibor Karaszi useful:

"The ultimate guide to the datetime datatypes"
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

749 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