Solved

Convert dateTime to Date output

Posted on 2014-01-16
3
328 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
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
Comment Utility
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
Comment Utility
I see that now.  

Thanks

glen
0
 
LVL 48

Expert Comment

by:PortletPaul
Comment Utility
no problem, you might find this page by Tibor Karaszi useful:

"The ultimate guide to the datetime datatypes"
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
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.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now