Solved

TSQL Date Format Query Syntax

Posted on 2011-03-10
4
378 Views
Last Modified: 2012-06-27


This I am sure its easy but I can find it online

I need to return a date with time as 0000 or no time

But I dont wat to use the convert because I dont what to make it a string

I like to keep it as a  date


This 2011-02-27 10:52:46.310

would return 2011-02-27 00:00:00.000
or 2011-02-27

what to keep as date not using convert


0
Comment
Question by:Leo Torres
4 Comments
 

Expert Comment

by:bizbiz20032003
ID: 35096080
Function Date(xxxxx) ?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35096091
cast ( yourfield as date)
0
 
LVL 15

Accepted Solution

by:
derekkromm earned 500 total points
ID: 35096131
dateadd(day, 0, datediff(day, 0, '2011-02-27 10:52:46.310'))
0
 
LVL 8

Author Closing Comment

by:Leo Torres
ID: 35096228
thank you that was exactly what I am looking for
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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
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.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

820 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