Home > Archive > MS SQL Server > November 2005 > Date Format as British









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Date Format as British
Kamal Ahmed

2005-11-30, 7:23 am

Hi All,

I want to set Date format as British (i.e. dd/MM/yyyy 30/11/2005) in my
Database. What I will have to do for this.

TIA


Andrea Montanari

2005-11-30, 7:23 am

hi Kamal,
Kamal Ahmed wrote:
> Hi All,
>
> I want to set Date format as British (i.e. dd/MM/yyyy 30/11/2005) in
> my Database. What I will have to do for this.
>

this "setting" is login's related, that's to say it depend on the login's
language property, but it can be set using
SET DATEFROMAT xxx
(http://msdn.microsoft.com/library/d...et-set_052s.asp)
for input...

please have a look at http://www.karaszi.com/SQLServer/info_datetime.asp
too..
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.16.0 - DbaMgr ver 0.61.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply


Absar Ahmad

2005-11-30, 7:23 am

Hopefully following posting can help you:

http://www.microsoft.com/technet/co...E3004596A551&ca
tlist=328BAFD2-1A81-4558-B1DE-B6EB49F31B7E&dglist=&ptlist=&exp=&sloc=en-us

"Kamal Ahmed" wrote:

> Hi All,
>
> I want to set Date format as British (i.e. dd/MM/yyyy 30/11/2005) in my
> Database. What I will have to do for this.
>
> TIA
>
>
>

David Portas

2005-11-30, 7:23 am

Kamal Ahmed wrote:
> Hi All,
>
> I want to set Date format as British (i.e. dd/MM/yyyy 30/11/2005) in my
> Database.


Why? DATEFORMAT is set in each connection so the database setting is
pretty redundant. Best practice is to ignore the DATEFORMAT setting and
write code that performs correctly however this may be set. Crucially
this means that any hard-coded dates should be coded in ISO rather than
local format:

'YYYYMMDD'
or
'YYYY-MM-DDThh:mm:ss'
or
'YYYY-MM-DDThh:mm:ss.mmm'

All other date values should be handled as DATETIME or SMALLDATETIME
(which are unaffected by the format setting) or converted from strings
using the CONVERT style property.

--
David Portas
SQL Server MVP
--

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com