ID | Title | Difficulty | |
---|---|---|---|
Loading... |
1853. Convert Date Format
Easy
LeetCode
Database
Problem
Table: Days
+-------------+------+
| Column Name | Type |
+-------------+------+
| day | date |
+-------------+------+
day is the primary key for this table.
Write an SQL query to convert each date in Days into a string formatted as “day_name, month_name day, year”.
Return the result table in any order.
The query result format is in the following example.
Example 1:
Input:
Days table:
+------------+
| day |
+------------+
| 2022-04-12 |
| 2021-08-09 |
| 2020-06-26 |
+------------+
Output:
+-------------------------+
| day |
+-------------------------+
| Tuesday, April 12, 2022 |
| Monday, August 9, 2021 |
| Friday, June 26, 2020 |
+-------------------------+
Explanation: Please note that the output is case-sensitive.
Code
SELECT DATE_FORMAT(day, "%W, %M %e, %Y") AS day
FROM Days
按 <- 键看上一题!
1843. Suspicious Bank Accounts
按 -> 键看下一题!
1857. Largest Color Value in a Directed Graph