Thanks to the diversity of cultures on Earth, we have a variety of date formats. For numeric dates, we have month-day-year, day-month-year, and year-month-day. We also have short and long formats. Dates can be mixed with time, which is another story. This reality follows us at work. That’s why the SQL date format is not something we can take easy.

In the Philippines, we use 2 formats: month-day-year and day-month-year. Month-day-year is the general format for numeric dates. But with longer date formats, we interchangeably use day-month-year and month-day-year.

At work, I never encountered SQL Server date format setting other than month-day-year. However, it varies in reports and files for data exchanges and Extract-Transform-Load (ETL) project. Let alone users who change it in their stations for personal preferences! With all these scenarios, not dealing with them appropriately is a recipe to break.

Do your apps deal with different cultures? That’s another level of complexity and a problem when dealing with these various SQL date formats. In this article, we’ll explore the standard to deal with all these varieties and examples. Read on until the end! But before we proceed, let’s take a short detour on how SQL Server stores dates.

#sql server #sql date #sql

SQL Date Format: How to Handle it the Smart Way
1.10 GEEK