Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the current session's dateformat

If you want to set the dateformat to some style say, ddMMyyyy, in sql server we can use the following statement:

SET DATEFORMAT dmy

My question is how to know before hand that this is the format set?

The program I am writing needs to determine, if the above is the actual datetimeformat, else set it and continue with rest of execution.

How is this possible? Else is my only approach, to set it to my desired format and continue with execution?

I hope setting this won't affect other sessions (connections)?

like image 538
deostroll Avatar asked Jan 24 '14 07:01

deostroll


1 Answers

To check the date format use

DBCC useroptions

SET DATEFORMAT will only effect the current session

MSDN Link

like image 118
praveen Avatar answered Sep 21 '22 03:09

praveen