I have a column Date with this format: 2019-07-01T07:03:05.612289+02:00
And I need chage thit final form yyyy-mm-ss (in this example 2019-07-01)
Unfortunately this code does nothing:
SELECT Format ([Date], "yyyy / mm / dd") FROM table_1;
Thaks for tips
Advertisement
Answer
If your scenario is straigh forward, you can try with LEFT() function:
SELECT LEFT([Date], 10) FROM table_1;
to convert the same text value into the yyyy-mm-dd date format, use the FORMAT() function:
SELECT FORMAT(LEFT([Date], 10), "yyyy-mm-dd") FROM table_1;