About 71,700 results
Open links in new tab
  1. How can I truncate a datetime in SQL Server? - Stack Overflow

    May 28, 2009 · 329 What's the best way to truncate a datetime value (as to remove hours minutes and seconds) in SQL Server? For example:

  2. What is the best way to truncate a date in SQL Server?

    Mar 1, 2010 · The first one is two date functions with a third function call, so there's at least three parsing operations, whereas the second is a single cast to string with a format applied (but therein lies the …

  3. Truncate a Datetime at different lengths without DATETRUNC

    Jun 15, 2025 · The 0000-01-01T00:00:00.000 is the non-ambigious date mask which gets replaced with the actual date value. The trunc contains the type of truncation to do, and length is the number of …

  4. how to use trunc date () function in oracle.? - Stack Overflow

    Aug 29, 2017 · The TRUNC function has the signature: TRUNC( date_value, format ) You are providing a string value instead of a date value and 'dd-mm-yy' is an invalid format (you just want to truncate to …

  5. Best approach to remove time part of datetime in SQL Server

    Jul 24, 2009 · it extends to work out first day of month, tomorrow, etc by changing "0" base Edit, Oct 2011 For SQL Server 2008+, you can CAST to date i.e. CAST(getdate() AS date). Or just use date …

  6. sql - Truncate date to only hour / minute - Stack Overflow

    Mar 20, 2012 · As of SQL Server 2022 CTP 2.1, there is a native function in SQL to do this called DATETRUNC(). You can pick the date/time level to which you would like to truncate the date.

  7. sql - When to use DATE_TRUNC () vs. DATE_PART ()? - Stack Overflow

    Feb 8, 2023 · The function date_trunc is conceptually similar to the trunc function for numbers. date_trunc (field, source [, time_zone ]) source is a value expression of type timestamp, timestamp …

  8. oracle SQL how to remove time from date - Stack Overflow

    Mar 3, 2012 · 27 When you convert your string to a date you need to match the date mask to the format in the string. This includes a time element, which you need to remove with truncation:

  9. Truncate Datetime to Second (Remove Milliseconds) in T-SQL

    Jan 26, 2012 · Truncate Datetime to Second (Remove Milliseconds) in T-SQL Asked 13 years, 10 months ago Modified 3 years, 9 months ago Viewed 115k times

  10. sql - How to trunc a date to seconds in Oracle - Stack Overflow

    Oct 1, 2008 · This page mentions how to trunc a timestamp to minutes/hours/etc. in Oracle. How would you trunc a timestamp to seconds in the same manner?