Nic
Member since Dec 11, 2008
- Profile: /members/2364-nic.htm
- Comments: 10
Recent Blog Comments By Nic
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Jan 27, 2011 at 11:59 AM
Hi IP, If [Rep_Date] has a 'time' component (other than midnight) with the date, then it will be outside the range of your 'BETWEEN' clause ... its simple to fix, so I'll leave that with you.... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on May 17, 2010 at 11:10 AM
Converting to an INT, before converting to datetime will round the value not truncate the time portion, so you can end up with the incorrect date, depending on whether the time was before or after 12:00 mid-day.... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Nov 9, 2009 at 4:04 PM
TB- Converting to a text field that only shows the date is fine, and valid, even if it isn't the most efficient way to remove a timestamp. -NB... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Sep 1, 2009 at 11:53 AM
Converting to INT doesn't work in all cases as it will round up to the following day for timestamps after 12:00 noon.... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Aug 21, 2009 at 1:55 PM
What if you are returning a sql query resultset as an email attachment from sql server using sendmail stored procedure ... is there another option for formatting?... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Aug 21, 2009 at 11:59 AM
Anyone know of an alternative method to string manipulation for removing the time portion from datetime field (without displaying '00:00:00.000' for the time portion)? Is this even possible?... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Aug 21, 2009 at 11:34 AM
Using string manipulation functions is fine if the pupose is to format the date (as text) for output to a report, or displaying query results (without timestamp). For data manipulation I agree it is best stick to mathematical functions, something computers do best. I like DATEADD/DATEDIFF, so I'll... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Aug 21, 2009 at 8:13 AM
One important factor seems to be left out here ... namely readability of the code. In most cases it doesn't matter one way or the other whether a query runs in 20 ms or 40 ms so performance isn't always an issue. When performance matters, then you can sacrifice readability for speed. It is import... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Aug 8, 2008 at 5:00 AM
Also ... 1. Date & Time truncated to date ... CAST(CONVERT(VARCHAR, getdate(), 111) AS DATETIME) '2008-07-18 14:15:29.000' -> '2008-07-18 00:00:00.000' 2. Date & Time truncated to minutes ... CAST(LEFT(CONVERT(VARCHAR, getdate(), 120), 16) AS DATETIME) '2008-07-18 14:15:29.000' -> '2... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Aug 8, 2008 at 4:14 AM
Easy solution ... CONVERT(DATETIME, CONVERT(VARCHAR, getdate(), 111)))... read more »