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

    May 28, 2009 · The only time you should ever find yourself truncating a datetime on Sql Server is when you need to group by the day, and even then you should probably have an extra column …

  2. sql - When to use DATE_TRUNC () vs. DATE_PART ()? - Stack …

    Feb 8, 2023 · date_trunc (field, source [, time_zone ]) source is a value expression of type timestamp, timestamp with time zone, or interval. (Values of type date and time are cast …

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

    Mar 1, 2010 · If I have a date value like 2010-03-01 17:34:12.018 What is the most efficient way to turn this into 2010-03-01 00:00:00.000? As a secondary question, what is the best way to …

  4. sql - Date_trunc by month? - Stack Overflow

    How would I get the date_trunc by month? Would it be like this? SELECT date_trunc('month', l_date) month FROM this_table GROUP BY month l_date is the column where I would pull the …

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

    Mar 20, 2012 · How do i trunc the date in sql server 2008 like this : I have 2012-01-02 12:04:11.443 and I want only to select 2012-01-02 12:00:00.000 and 2012-01-02 12:04:00.000 …

  6. 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 …

  7. sql - How to get the last day of month in postgres? - Stack Overflow

    Jan 28, 2015 · date_trunc('month',current_date) + interval '1 month' - interval '1 day' Truncating any date or timestamp to the month level will give you the first of the month containing that date.

  8. sql server - How do I solve 'DATE_TRUNC' is not a recognized built …

    Dec 1, 2022 · How do I solve 'DATE_TRUNC' is not a recognized built-in function name in sql Asked 2 years, 11 months ago Modified 2 years, 11 months ago Viewed 12k times

  9. sql - How to extract year and month from date in PostgreSQL …

    66 Use the date_trunc method to truncate off the day (or whatever else you want, e.g., week, year, day, etc..) Example of grouping sales from orders by month:

  10. sql - Round date to 10 minutes interval - Stack Overflow

    Jan 1, 2010 · I have a DATE column that I want to round to the next-lower 10 minute interval in a query (see example below). I managed to do it by truncating the seconds and then subtracting …