How to Format Dates in SQL Server (Hint: Don’t Use FORMAT!)


Introduction

First of all, I agree with most of the heavy hitters in saying that you should avoid formatting in both the “Data Layer” and the “Business Layer” of your applications and that it should only be done in the “Presentation Layer”. The two big reasons for that are…

It’s cheaper to do such conversions in the application layer. SQL Server is expensive compared to the application layer and shouldn’t usually be bogged down with formatting tasks. If done properly in the “Presentation Layer”, the dates and times can follow the “local formatting” that the user has on their