Skip navigation

How can I convert a SQL date/time to just date?

A. The SQL date/time field stores a date and time but if you have a populated table and you want to convert a column so it lists data only run the following:

update <table>
where <column>=convert(datetime,convert(char(10),<column>,101))

For example

update faq
where created=convert(datetime,convert(char(10),created,101))


Read more FAQs

Also, learn more about how to ORDER BY different fields based on a variable in SQL Server and how to encrypt fields in SQL Server.

 

TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish