Skip to content
Advertisement

Date Format Convert

I am dealing with sql DB where the date is recorded in this format ‘2020-348T08:55’. I need to convert this to datetime.

Please guide if there is possible way to do that?

Advertisement

Answer

With string and date/time functions extract the year and days to create a DATETIME without the time and finally add the time part:

If the days part is always a 3 digit number, it can be simplified:

Replace col with your column’s name.
See the demo.
Result:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement