SQL SERVER – Display Dates in Different cultures FORMAT

Today we are going to learn a very simple and interesting concept which is used very little in the industry. It is about how to Display Dates in Different cultures FORMAT.

Let us assume that you want to display your current date and time in different formats in different geographic locations with the help of SQL Server. In SQL Server we have an option for function FORMAT which can make things easy for us.

For example, if you want to convert today’s date and time to any other culture’s date and time, you can easily do that by using the following query.

DECLARE @dt DATETIME = GETDATE();
SELECT FORMAT( @dt, 'F', 'en-US' ) 'US English'
,FORMAT( @dt, 'F', 'gu') 'Gujarati India'
,FORMAT( @dt, 'F', 'es' ) 'Spanish'
,FORMAT( @dt, 'F', 'is') 'Icelandic'; 

The result of the query will be as following:

 

Well, that’s it for today. You can use any other local and get your preferred results. I will be interesting to see what is your local and its result, why not paste that in the comment section below.

Here are my few recent videos and I would like to know what is your feedback about them. You can also subscribe to my YouTube Channel – SQL in Sixty Seconds.

Reference: Pinal Dave (http://blog.SQLAuthority.com)

SQL DateTime, SQL Scripts, SQL Server
Previous Post
Slowloris DDoS Attack Mitigation
Next Post
SQL SERVER – Unlocking User Without Changing Password

Related Posts

5 Comments. Leave new

Leave a Reply

Menu
Exit mobile version