About 2,830,000 results
Open links in new tab
  1. Date and Time Data Types and Functions - SQL Server (Transact-SQL

    The data type of the date argument: Deterministic: EOMONTH: EOMONTH ( start_date [ , month_to_add] ) Returns the last day of the month containing the specified date, with an optional offset. Return type is the type of the start_date argument, or alternately, the date data type. Deterministic: SWITCHOFFSET: SWITCHOFFSET (DATETIMEOFFSET, time_zone)

  2. List of Date Formats Available with CONVERT () in SQL Server

    Jan 12, 2021 · The following table contains a list of the date formats that you can provide to the CONVERT() function when you convert a date/time value to a string. These formats are provided as an optional third argument when calling the CONVERT() function. They’re provided as an integer expression that specifies how the CONVERT() function will format the date.

  3. date (Transact-SQL) - SQL Server | Microsoft Learn

    Nov 22, 2024 · Defines a date in SQL Server. The date data type was introduced in SQL Server 2008 (10.0.x). For more information, see the Backward compatibility for down-level clients section. yyyy is four digits from 0001 to 9999 that represent a …

  4. datetime (Transact-SQL) - SQL Server | Microsoft Learn

    Jan 13, 2025 · Instead, use the time, date, datetime2, and datetimeoffset data types. These types align with the SQL Standard, and are more portable. time, datetime2 and datetimeoffset provide more seconds precision. datetimeoffset provides time zone support for globally deployed applications. yyyy is four digits from 1753 through 9999 that represent a year.

  5. SQL Date Format Examples using CONVERT Function

    Learn SQL date format options with the SQL CONVERT function when working with date data types in SQL Server.

  6. Format SQL Server Dates with FORMAT Function

    Dec 17, 2024 · Use the FORMAT function to format the date and time data types from a date column (date, datetime, datetime2, smalldatetime, datetimeoffset, etc. data type) in a table or a variable such as GETDATE() To get DD/MM/YYYY use SELECT FORMAT (getdate(), ‘dd/MM/yyyy ‘) as date; To get MM-DD-YY use SELECT FORMAT (getdate(), ‘MM-dd-yy’) as date

  7. What is the default date style used by an instance of SQL Server

    May 6, 2020 · In SQL Server, regardless of data type and language, those are yyyy-MM-ddThh:mm:ss.nnnnnnn and yyyyMMdd. If you're convert to an (n)varchar, always use a style code (and a length for your varchar) for consistent results.

  8. SQL Server Date Format Cheatsheet - TablePlus

    Sep 13, 2018 · In this post, we are going to introduce all the date formats, as long as the corresponding CONVERT() statement in SQL Server. General syntax to convert a datetime or smalldatetime value to character: SELECT CONVERT(VARCHAR(n), GETDATE(), style)

  9. Custom Date/Time formatting in SQL Server - Stack Overflow

    The Datetime format field has the following format 'YYYY-MM-DD HH:MM:SS.S' The 2 additional fields which should be in the following format: Example: If the data in the field was '2008-10-12 13:19:12.0' then the extracted fields should contain: I have tried using CONVERT string formats, but none of the formats match the output I want to get.

  10. Learn about SQL Date Data TypesDate, DateTime, DateTime2, …

    Mar 15, 2023 · SQL Developers and DBAs use different date data types, such as DATE, DATETIME, and DATETIME2, to store datetime values. In contrast, each one of these types has a use case which we will cover in this T-SQL tutorial.