You can use FORMAT function to get the format you want.

For example:

SELECT
GETDATE() AS now,
FORMAT(GETDATE(), 'yyyy-MM-ddThh:mm:ss.fffZ') AS formarted_date
FROM
[DE name]

Result:

Now: Apr 20 2023 1:00AM 
formarted_date: 2023-04-20T01:00:02.800Z

Reference: https://www.w3schools.com/sql/func_sqlserver_format.asp

Answer from Duc Le on Stack Exchange
๐ŸŒ
SQL Authority
blog.sqlauthority.com โ€บ home โ€บ sql server โ€“ retrieve โ€“ select only date part from datetime โ€“ best practice โ€“ part 2
SQL SERVER - Retrieve - Select Only Date Part From DateTime - Best Practice - Part 2 - SQL Authority with Pinal Dave
March 6, 2017 - FLOOR Method: CAST( FLOOR( CAST( GETDATE() AS FLOAT ) ) AS DATETIME ) ... how can i count the records using where condition i m trying the following query but no any result:- select Count(*) from tbname where date_time=โ€™7/29/2010โ€ฒ ... are you sure you using the correct date format in where condition. First run the select and see the format of date and then you can use date >= โ€™29-07-2010โ€ฒ. I am sure its the date format and your date should be in the format of dd-mm-yyyy instead of dd/mm/yyyyReply
๐ŸŒ
PostgreSQL
postgresql.org โ€บ docs โ€บ current โ€บ datatype-datetime.html
PostgreSQL: Documentation: 18: 8.5. Date/Time Types
3 weeks ago - Date and time input is accepted in almost any reasonable format, including ISO 8601, SQL-compatible, traditional POSTGRES, and others. For some formats, ordering of day, month, and year in date input is ambiguous and there is support for specifying the expected ordering of these fields.
Discussions

How to change date format from YYMMDD to DD-MM-YYYY
Hi Team, Can any one help to convert date format YYMMDD to DD-MM-YYYY in a sql script. In data I have a date like 220504 which I want to convert into 04-05-2022. I have tried below given way but i am getting error. cโ€ฆ More on forums.sqlteam.com
๐ŸŒ forums.sqlteam.com
0
July 10, 2023
marketing cloud - Add a date field to SQL and convert the formatting to 'yyyy-MM-ddThh:mm:ss.fffZ' - Salesforce Stack Exchange
I have an SQL running off a data view tabe and I need to add the ExtractDate to the target Data extensio.Date field doesn't exist in this Dataview tablem so apart from adding it, I need to convert ... More on salesforce.stackexchange.com
๐ŸŒ salesforce.stackexchange.com
April 20, 2023
sql server - How to get a date in YYYY-MM-DD format from a TSQL datetime field? - Stack Overflow
How do I retrieve a date from SQL Server in YYYY-MM-DD format? I need this to work with SQL Server 2000 and up. Is there a simple way to perform this in SQL Server or would it be easier to convert it More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to return only the Date from a SQL Server DateTime datatype - Stack Overflow
SELECT GETDATE() Returns: 2008-09-22 15:24:13.790 I want that date part without the time part: 2008-09-22 00:00:00.000 How can I get that? More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ sql โ€บ t-sql โ€บ data-types โ€บ date-transact-sql
date (Transact-SQL) - SQL Server | Microsoft Learn
Datetime data types allow dates in the Gregorian format to be stored in the date range 0001-01-01 CE through 9999-12-31 CE. The default string literal format, which is used for down-level clients, complies with the SQL standard form that is defined as yyyy-MM-dd.
๐ŸŒ
SQLTeam
forums.sqlteam.com โ€บ other sql server topics
How to change date format from YYMMDD to DD-MM-YYYY - Other SQL Server Topics - SQLTeam.com Forums
July 10, 2023 - Hi Team, Can any one help to convert date format YYMMDD to DD-MM-YYYY in a sql script. In data I have a date like 220504 which I want to convert into 04-05-2022. I have tried below given way but i am getting error. convert(varchar(10),cast(a.TRANSACTION_DATE as DATE),103) NEWDATE Thanks in advance
๐ŸŒ
Karpach
karpach.com โ€บ t-sql โ€บ get-only-date-from-datetime
T-SQL: How to get only Date from DateTime?
T-SQL: How to get only Date from DateTime? SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())) Here is how you can get time only from a DateTime field: SELECT DATEADD(day, 0, -DATEDIFF(day, 0, GETDATE())) Posted on January 3, 2008 by Viktar Karpach ยท
๐ŸŒ
JanBask Training
janbasktraining.com โ€บ community โ€บ sql-server โ€บ how-to-return-only-the-date-from-a-sql-server-datetime-datatype1
How to return only the Date from a SQL Server DateTime datatype | JanBask Training Community
August 16, 2025 - Use string formatting only when you need the date in a specific textual format. In short, CAST(GETDATE() AS DATE) or CONVERT(DATE, GETDATE()) are the cleanest ways to return only the date from a DateTime value in SQL Server.
Find elsewhere
๐ŸŒ
Database Guide
database.guide โ€บ convert-yyyymmdd-to-date-in-sql-server
Convert YYYYMMDD to DATE in SQL Server
SELECT CAST( CAST( 20281030 AS char(8)) AS datetime2 ); ... As expected, a whole bunch of zeros are added. One possible reason for converting the yyyymmdd number to an actual date type might be to format the date. For example, we might want to format the date as mm/dd/yyyy.
๐ŸŒ
CodingSight
codingsight.com โ€บ home โ€บ converting datetime to yyyy-mm-dd format in sql server
How to Convert DateTime to Date Format in SQL Server
July 24, 2023 - The DOB column has values in YYYY-MM-DD format, but for the DOD column, you pass the HH:MM: SS (hours: minutes: seconds) information. Letโ€™s now see how our Patient table looks. Execute the following SQL script to select all records from the Patient table: ... Often, we need only the date part from the DateTime column.
๐ŸŒ
SQL Shack
sqlshack.com โ€บ sql-date-format-overview-datediff-sql-function-dateadd-sql-function-and-more
SQL date format Overview; DateDiff SQL function, DateAdd SQL function and more
May 3, 2019 - In this SQL date format, the HireDate column is fed with the values โ€˜MM-DD-YYYYโ€™. This is not an integer format. Let us run the same query with the new SQL date format of input value โ€˜12-07-2008โ€™ to the HireDate column. So letโ€™s run the following query and verify the output.
๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ java_date.asp
Java Date and Time
The "T" in the example above is used to separate the date from the time. You can use the DateTimeFormatter class with the ofPattern() method in the same package to format or parse date-time objects.
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ sql โ€บ t-sql โ€บ data-types โ€บ datetime-transact-sql
datetime (Transact-SQL) - SQL Server | Microsoft Learn
@datetime @date ------------------------ ----------- 2016-12-21 00:00:00.000 2016-12-21 ยท The previous example uses a region specific date format (MM-DD-YY). ... You should update the example to match the format for your region. You can also complete the example with the ISO 8601 compliant date format (yyyy-MM-dd).
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ ISO_8601
ISO 8601 - Wikipedia
1 week ago - There is no limit on the number of decimal places for the decimal fraction. However, the number of decimal places needs to be agreed to by the communicating parties. For example, in Microsoft SQL Server, the precision of a decimal fraction is 3 for a DATETIME, i.e., "yyyy-mm-ddThh:mm:ss[.mmm]".
๐ŸŒ
PHP
php.net โ€บ manual โ€บ en โ€บ function.date.php
PHP: date - Manual
date โ€” Format a Unix timestamp ยท Returns a string formatted according to the given format string using the given integer timestamp (Unix timestamp) or the current time if no timestamp is given. In other words, timestamp is optional and defaults to the value of time()
๐ŸŒ
Sentry
sentry.io โ€บ sentry answers โ€บ sql server โ€บ how to return only the date from a sql server datetime datatype
How to return only the date from a SQL Server DateTime datatype | Sentry
For example, 2023-08-09. The simplest solution is to use CAST. This code works in SQL Server 2008 and later versions. ... You can further format this date in your applicationโ€™s code to look however you prefer.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ sql โ€บ sql-query-to-convert-datetime-to-date
SQL Query to Convert DateTime to Date in SQL Server - GeeksforGeeks
Explanation: In this example, we first CONVERT() the current DateTime to a varchar string with format 23 (YYYY-MM-DD), then use SUBSTRING() to get only the date part.
Published ย  July 23, 2025
๐ŸŒ
MSSQLTips
mssqltips.com โ€บ home โ€บ sql date format examples using convert function
SQL Date Format Examples using SQL CONVERT Function
September 26, 2025 - DECLARE @Datetime DATETIME; SET @Datetime = GETDATE(); --mm/dd/yyyy with 4 DIGIT YEAR SELECT CONVERT(VARCHAR(10), @Datetime, 101) CurrentDateFormattedAsText; --mm/dd/yy with 2 DIGIT YEAR SELECT CONVERT(VARCHAR(8), @Datetime, 1) CurrentDateF...