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 ExchangeSQL 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.
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
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
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
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
Videos
SQL server tutorial: How to extract only date with all formats ...
02:59
How to get only Date from Datetime in SQL Server - YouTube
04:21
How to Return Date Part Only from a SQL Server Datetime datatype ...
SQL Server Search By Date Only in DateTime Field
00:13
MSSQL - how to return only date from sql server DateTime datatype ...
01:34
Date part from datetime SQL Server - YouTube
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 ยท
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.
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).
Zdqjec
zdqjec.wtf โบ !2 โบ 5zju9d โบ efnpn2ovxpc55246.html
Get only date from datetime in sql dd mm yyyy example
We cannot provide a description for this page right now
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]".
Top answer 1 of 16
510
SELECT CONVERT(char(10), GetDate(),126)
Limiting the size of the varchar chops of the hour portion that you don't want.
2 of 16
180
SELECT convert(varchar, getdate(), 100) -- mon dd yyyy hh:mmAM
SELECT convert(varchar, getdate(), 101) -- mm/dd/yyyy โ 10/02/2008
SELECT convert(varchar, getdate(), 102) -- yyyy.mm.dd โ 2008.10.02
SELECT convert(varchar, getdate(), 103) -- dd/mm/yyyy
SELECT convert(varchar, getdate(), 104) -- dd.mm.yyyy
SELECT convert(varchar, getdate(), 105) -- dd-mm-yyyy
SELECT convert(varchar, getdate(), 106) -- dd mon yyyy
SELECT convert(varchar, getdate(), 107) -- mon dd, yyyy
SELECT convert(varchar, getdate(), 108) -- hh:mm:ss
SELECT convert(varchar, getdate(), 109) -- mon dd yyyy hh:mm:ss:mmmAM (or PM)
SELECT convert(varchar, getdate(), 110) -- mm-dd-yyyy
SELECT convert(varchar, getdate(), 111) -- yyyy/mm/dd
SELECT convert(varchar, getdate(), 112) -- yyyymmdd
SELECT convert(varchar, getdate(), 113) -- dd mon yyyy hh:mm:ss:mmm
SELECT convert(varchar, getdate(), 114) -- hh:mm:ss:mmm(24h)
SELECT convert(varchar, getdate(), 120) -- yyyy-mm-dd hh:mm:ss(24h)
SELECT convert(varchar, getdate(), 121) -- yyyy-mm-dd hh:mm:ss.mmm
SELECT convert(varchar, getdate(), 126) -- yyyy-mm-ddThh:mm:ss.mmm
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...
Top answer 1 of 16
2876
NOTE: This answer returns the original DATETIME or DATETIME2 type. For an expression that returns a true DATE type (SQL Server 2008 and later), see BenR's answer below.
SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, @your_date))
for example
SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))
gives me
2008-09-22 00:00:00.000
Pros:
- No varchar<->datetime conversions required
- No need to think about locale
2 of 16
1028
SQLServer 2008 now has a 'date' data type which contains only a date with no time component. Anyone using SQLServer 2008 and beyond can do the following:
SELECT CONVERT(date, GETDATE())