SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Thai Buddhist Calendar format in SQL Server 2005


Thai Buddhist Calendar format in SQL Server 2005

Author
Message
ganand_online
ganand_online
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 6
People in Thailand use the Thai Buddha calendar format, which is 543 years ahead of the Gregorian calendar format. The year in the Thai Buddha calendar now is 2551. This, though handled in the operating system (Windows 2003), is not handled in SQL Server 2005.

I have tried searching settings in SQL Server, but have not been able to find anything. Is there a setting where I can set the calendar/date formats at the server/database level?

Steps to reproduce the problem:

1. Change Windows regional settings to Thai.
2. Add the Thai language in the Windows regional settings.
3. Set THAI_CS_AS as the default collation during SQL Server installation.
4. Set THAI_CS_AS as the collation for the database I'm testing this on.
5. Set the default language to Thai (sp_configure 'default_language', 32)
6. Run the following commands:

===
set language Thai
go
set dateformat 'dmy'
go

DECLARE @Today DATETIME
SET @Today = '12/1/2008'
SELECT DATENAME(month, @Today) AS 'Month'
===

The output I get is this (and this is the expected output): มกราคม

However, when I try running the same query to get the date:

===
DECLARE @Today DATETIME
SET @Today = '12/1/2008'
SELECT DATENAME(year, @Today) AS 'Year'
===

I get '2003' as the output. It should be displaying 2551.

I would like to know if there is a setting where I can set the calendar format from Gregorian to Thai Buddhist at the database/server level.
RyanRandall
RyanRandall
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2279 Visits: 4652
2003? Wow - that is crazy.

I don't see how SQL Server will return anything other than 2008 when you ask it for the year of '12/1/2008'.

Ryan Randall

Solutions are easy. Understanding the problem, now, that's the hard part.
ganand_online
ganand_online
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 6
Hi Ryan,

2003 was an example... :-)

We checked this out in Oracle... it is supported by setting up a parameter nls_calendar. It returns the date as 17-04-2551 which is the current date in Bhuddist Calendar.

We wanted this Bhuddist date in the apps screens using MS SQL SERVER.

Any solution?
SwePeso
SwePeso
Hall of Fame
Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)Hall of Fame (4K reputation)

Group: General Forum Members
Points: 3995 Visits: 3433
SELECT DATEADD(YEAR, 543, GETDATE())


N 56°04'39.16"
E 12°55'05.25"
ganand_online
ganand_online
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 6
Hi,

:-) I wish it were as simple as adding another 543 years to the date, but there are complications involved. More on the Buddhist calendar here: http://en.wikipedia.org/wiki/Buddhist_calendar

Is there any way we can change the default calendar format from Gregorian (the current year is 2008) to Thai Buddhist calendar (the current year is 2551)?
steveb.
steveb.
SSCarpal Tunnel
SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)

Group: General Forum Members
Points: 4372 Visits: 7195
What calender is the server using?

does this show the year as 2551?
ganand_online
ganand_online
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 6
When we do a mouseover on the system clock, it displays 2551, but when you double-click and open the system clock, it displays 2008 (I guess this is how it works after setting the Windows Regional Settings to Thai).
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search