Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How to Format date and datetime in Sql Server?

format SQL Server
3
Frank B Posted

How to Format date and datetime in Sql Server?

0
Frank B

I typically shorten datetime to date via this format:

SELECT convert(varchar, getdate(), 102) – yyyy.mm.dd – 2008.10.02  
or this
SELECT convert(varchar, getdate(), 112) – yyyymmdd

Here are some additional good reference sites for this:
http://www.sql-server-helper.com/tips/date-formats.aspx
http://anubhavg.wordpress.com/2009/06/11/how-to-format-datetime-date-in-sql-server-2005/

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123