Date Prob

A

amatuer

In Sa the date format is dd/mm/yy. in sql server the format the format
is mm/dd/yy.
What code can be used to chnge the format to the SA date format
eithout chnging sql servers regional settings?
 
B

Bob Barrows [MVP]

A

Aaron Bertrand [SQL Server MVP]

Always use a non-regional date format, e.g. yyyymmdd. I use a function for
this, e.g.

function fixDate(dt)
fixDate = year(dt) & _
right("0" & month(dt),2) & _
right("0" & day(dt),2)
end function

Now, when I take the date from the server, or the date value from the
database, I can run it through this function and not have to worry about
trying to figure out if it is British or Canadian or American or Swahili...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top