'How to change data format in sql?
I'm trying to change the data format to the "Aug 15, 2005" type from "2005-08-15" in SQL. I've tried multiple different functions like DATE_FORMAT, FORMAT, CONVERT, etc. But it seems like nothing has worked.
SELECT FORMAT(release_date, 'MMM dd, yyyy') AS publish_date
FROM articles;
This doesn't return an error, however, it returns
| publish_date |
|---|
| 2005-08-15 |
Column alias worked but the format hasn't changed.
It must be a simple thing but I can't figure it out. I will appreciate it if anyone can help me with this. This is my first time asking a question here, sorry if my question isn't clear. If so, please let me know! Thanks :)
Solution 1:[1]
SELECT FORMAT (getdate(), 'dddd, MMMM, yyyy') AS date
This should output as long day, long month, and long year.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | marc_s |
