I have a SQL query in which I will be passing dd/mm/yyyy
but the SQL query requires mm/dd/yyyy
.
How can I enable this query to take d
For the query I would use dates in YYYY-MM-DD
format. As to the output see kalyan's answer.
EDIT: To summarise the comments below (thanks to marc_s) it is necessary to use the format YYYYMMDD
when the time part is not included unless you are using the new date types date
, datetime2
and datetimeoffset
in SQL Server 2008.
Refer to the DateTime Formating for this purpose, by providing certain parameters we can format the date into required format.