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
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 can I get just YYYY-MM-DD from DATE_TRUNC?
Add ::date at the end, in redshift anyways More on reddit.com
🌐 r/SQL
8
9
September 7, 2024
🌐
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.
🌐
Oreate AI
oreateai.com › blog › sql-date-formatting-unpacking-the-yyyymmdd-puzzle › aa24e89055e097e46e6ccdbaaf46ebd2
SQL Date Formatting: Unpacking the YYYY-MM-DD Puzzle - Oreate AI Blog
1 month ago - Learn how to convert date values in SQL Server to the YYYY-MM-DD format using the CONVERT function with style code 120, ensuring clear and consistent data presentation.
Find elsewhere
🌐
Database Guide
database.guide › convert-yyyymmdd-to-date-in-sql-server
Convert YYYYMMDD to DATE in SQL Server
February 22, 2023 - 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
2 weeks 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...