Try this

Cast('7/7/2011' as datetime)

and

Convert(DATETIME, '7/7/2011', 101)

See CAST and CONVERT (Transact-SQL) for more details.

Answer from gauravg on Stack Overflow
🌐
Microsoft Learn
learn.microsoft.com › en-us › sql › t-sql › functions › cast-and-convert-transact-sql
CAST and CONVERT (Transact-SQL) - SQL Server | Microsoft Learn
Reference for the CAST and CONVERT Transact-SQL functions. These functions convert expressions from one data type to another.
🌐
W3Schools
w3schools.com › sql › func_sqlserver_convert.asp
SQL Server CONVERT() Function
The CONVERT() function converts a value (of any type) into a specified datatype.
🌐
Google
docs.cloud.google.com › bigquery › migrating to googlesql
Migrating to GoogleSQL | BigQuery | Google Cloud Documentation
BigQuery supports two SQL dialects: GoogleSQL and legacy SQL. This document explains the differences between the two dialects, including syntax, functions, and semantics, and gives examples of some of the highlights of GoogleSQL · When initially released, BigQuery ran queries using a non-GoogleSQL ...
🌐
W3Schools
w3schools.com › sql › sql_dates.asp
Date Functions in SQL Server and MySQL
String Functions: ASCII CHAR CHARINDEX CONCAT Concat with + CONCAT_WS DATALENGTH DIFFERENCE FORMAT LEFT LEN LOWER LTRIM NCHAR PATINDEX QUOTENAME REPLACE REPLICATE REVERSE RIGHT RTRIM SOUNDEX SPACE STR STUFF SUBSTRING TRANSLATE TRIM UNICODE UPPER Numeric Functions: ABS ACOS ASIN ATAN ATN2 AVG CEILING COUNT COS COT DEGREES EXP FLOOR LOG LOG10 MAX MIN PI POWER RADIANS RAND ROUND SIGN SIN SQRT SQUARE SUM TAN Date Functions: CURRENT_TIMESTAMP DATEADD DATEDIFF DATEFROMPARTS DATENAME DATEPART DAY GETDATE GETUTCDATE ISDATE MONTH SYSDATETIME YEAR Advanced Functions CAST COALESCE CONVERT CURRENT_USER IIF ISNULL ISNUMERIC NULLIF SESSION_USER SESSIONPROPERTY SYSTEM_USER USER_NAME MS Access Functions
🌐
SQL Shack
sqlshack.com › sql-server-functions-for-converting-string-to-date
SQL Server functions for converting a String to a Date
May 21, 2021 - The second approach for converting data types is the explicit conversion which is done by using some functions or tools. In SQL Server, converting a string to date explicitly can be achieved using CONVERT().
🌐
GeeksforGeeks
geeksforgeeks.org › sql › sql-query-to-convert-datetime-to-date
SQL Query to Convert DateTime to Date in SQL Server - GeeksforGeeks
The CAST() function in SQL Server is one of the most flexible functions available. It allows you to explicitly convert one data type to another, and it's perfect for stripping off the time portion from a DateTime value.
Published   July 23, 2025
Find elsewhere
🌐
KajoData
kajodata.com › main page › knowledge base – excel, sql, python, powerbi, tableau, statistics › knowledge base – sql › how convert works in sql? best convert examples
How CONVERT works in SQL? Best CONVERT examples - KajoData
February 21, 2025 - When working with SQL, I often find myself needing to transform data from one type to another. This is where the CONVERT function comes into play. It’s an essential tool for handling type conversions in SQL Server.
🌐
MSSQLTips
mssqltips.com › home › sql convert function in depth
SQL Convert Function In Depth
January 20, 2022 - The CONVERT function is a conversion function that allows you to both convert data between different datatypes and format the result at the same time. Eg. convert text input to a specific date format. It is important to note that the CONVERT function is specific to SQL Server and is not part ...
Top answer
1 of 16
368

Try this

Cast('7/7/2011' as datetime)

and

Convert(DATETIME, '7/7/2011', 101)

See CAST and CONVERT (Transact-SQL) for more details.

2 of 16
62

Run this through your query processor. It formats dates and/or times like so and one of these should give you what you're looking for. It wont be hard to adapt:

Declare @d datetime
select @d = getdate()

select @d as OriginalDate,
convert(varchar,@d,100) as ConvertedDate,
100 as FormatValue,
'mon dd yyyy hh:miAM (or PM)' as OutputFormat
union all
select @d,convert(varchar,@d,101),101,'mm/dd/yy'
union all
select @d,convert(varchar,@d,102),102,'yy.mm.dd'
union all
select @d,convert(varchar,@d,103),103,'dd/mm/yy'
union all
select @d,convert(varchar,@d,104),104,'dd.mm.yy'
union all
select @d,convert(varchar,@d,105),105,'dd-mm-yy'
union all
select @d,convert(varchar,@d,106),106,'dd mon yy'
union all
select @d,convert(varchar,@d,107),107,'Mon dd, yy'
union all
select @d,convert(varchar,@d,108),108,'hh:mm:ss'
union all
select @d,convert(varchar,@d,109),109,'mon dd yyyy hh:mi:ss:mmmAM (or PM)'
union all
select @d,convert(varchar,@d,110),110,'mm-dd-yy'
union all
select @d,convert(varchar,@d,111),111,'yy/mm/dd'
union all
select @d,convert(varchar,@d,12),12,'yymmdd'
union all
select @d,convert(varchar,@d,112),112,'yyyymmdd'
union all
select @d,convert(varchar,@d,113),113,'dd mon yyyy hh:mm:ss:mmm(24h)'
union all
select @d,convert(varchar,@d,114),114,'hh:mi:ss:mmm(24h)'
union all
select @d,convert(varchar,@d,120),120,'yyyy-mm-dd hh:mi:ss(24h)'
union all
select @d,convert(varchar,@d,121),121,'yyyy-mm-dd hh:mi:ss.mmm(24h)'
union all
select @d,convert(varchar,@d,126),126,'yyyy-mm-dd Thh:mm:ss:mmm(no spaces)'
🌐
TechOnTheNet
techonthenet.com › sql_server › functions › convert.php
SQL Server: CONVERT Function
In SQL Server (Transact-SQL), the CONVERT function converts an expression from one datatype to another datatype. If the conversion fails, the function will return an error.
🌐
MSSQLTips
mssqltips.com › home › sql date format examples using convert function
SQL Date Format Examples using SQL CONVERT Function
September 26, 2025 - Learn how to use SQL CONVERT for different SQL date format options and achieve the desired date representation.
🌐
ChartDB
chartdb.io
ChartDB - Database schema diagrams visualizer
Dialect Converter · Comparisons · DrawSQL · dbdiagram.io · drawdb · DBeaver ERD · SQLDBM · SchemaSpy · Azimutt.app · About · Docs · Blog · Templates · Changelog · Open Source ERD · AutoSync your Diagram · © 2025 ChartDB · Instantly visualize your database schema and generate ER diagrams.
🌐
Wikipedia
en.wikipedia.org › wiki › List_of_SQL_reserved_words
List of SQL reserved words - Wikipedia
2 weeks ago - This list includes SQL reserved words – aka SQL reserved keywords, as the SQL:2023 specifies and some RDBMSs have added. A dash (—) means that the keyword is not reserved. ... Page listing all reserved words in the SQL standard, from SQL-92 to SQL:2016: Standard SQL Reserved Words Summary.
🌐
SQL Shack
sqlshack.com › sql-convert-date
SQL convert date
November 28, 2019 - FORMAT is easier to handle dates and use the format of your preference, because you do not need to know the style. However, in my experience I see a lot of code using the CAST and CONVERT functions so, it is better to know them.
🌐
Reddit
reddit.com › r/sql › cast vs convert?
r/SQL on Reddit: Cast vs convert?
March 29, 2024 -

I am trying to understand the difference between cast and convert.

I have googled it, and looked for explanations online and there are LOTS of them and I think this might just be a me thing, but for me, when I am learning something new I find it helpful when it is explained in a way that is simple and with minimal jargon (which I know is kind of hard because none of you really know where I am at in my SQL learning journey). So I thought I would just post here to ask a noob question lol 😛

🌐
SQLServerCentral
sqlservercentral.com › forums › topic › convert-text-to-date-datatype
Convert Text to Date DataType – SQLServerCentral Forums
August 14, 2012 - Actually, SQL can convert '17/08/12' and '17/08/2012' into date without help of the third (dateformat) parameter. You are facing the issue due to the default format on your server is in American style (mm/dd/yyy). You can easily change it any time to whatever you like.
🌐
Draxlr
draxlr.com › tools › bar-chart-generator
Free Bar Chart Maker Online | Draxlr — Self-Serve Business Intelligence tool
Create bar charts online instantly. Built by Draxlr, Self-Serve BI tool for SQL dashboards and data teams.
🌐
Oreate AI
oreateai.com › blog › unlocking-sql-servers-convert-function-a-guide-to-data-transformation › 5fc8a810764e779cb0c1d6b894f6bbbd
Unlocking SQL Server's `CONVERT` Function: A Guide to Data Transformation - Oreate AI Blog
3 weeks ago - Explore Microsoft SQL Server's CONVERT function for transforming data types. Learn about date/time styles, numerical formatting, binary/XML conversions, and the difference between implicit and explicit transformations.