August 8, 2019 at 4:34 am
Hi,
I have a requirement where i need to store nepal calendar date in a date column in sql table. Nepal calendar is totally different from regular english calendar whereas it has 32 days also in some month. Is it possible to Install SQL with region and calendar settings as Nepal. Thanks in Advance!
Chelladurai
August 8, 2019 at 11:47 am
What happens if you run this query?
select * from sys.time_zone_info order by 1
In Azure Sql the 77th row is:
Nepal Standard Time, +05:45, 0
What happens if you run this next query?
select cast(sysdatetimeoffset() at time zone 'Nepal Standard Time' as datetime2)
In Azure Sql:
2019-08-08 17:30:56.3539570
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
August 8, 2019 at 12:07 pm
Sorry, you asked if it's possible to install Sql Server with the Nepalese calendar. Sql will inherit the time zone info from the OS it's installed on. So if you're able to control the system clock of the server it should be possible to set it to Nepal Standard Time.
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
August 9, 2019 at 3:25 am
Thanks for the response. But the question is not about Time it is Nepal Date & Year.
August 9, 2019 at 3:29 am
Hi, I need to store the Nepal date & year in sql table column and not time. For ex: if you check today's date in nepal it is 24 and the year is 2076. And this month they have 32 days!
August 9, 2019 at 11:18 am
Oh ok I've looked into a little more. Sql does get calendar/clock time zone info from the OS (on Windows, not sure how it works on Linux). This is a subject area where Microsoft tells governments what they're supposed to do and sometimes there are disagreements. Yikes! The Nepali calendar is converted to by a combination of look up and calculation. Double yikes!
Is it possible for the Nepal date to be passed into Sql as a fixed parameter?
All of my projects have to deal with time zones in one way or another. My advice is to avoid custom coding anything having to do with tzi. Suppose you write or borrow code to do the look up and calculation and it works correctly. Now you have 2 problems where before you only had 1. Because now you have to maintain a calendar and calculation which are subject to change (sometimes political whim is involved). When something goes wrong... guess who gets the blame!
Possible solutions:
Do you wish to code or mash your own converter?
Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können
August 9, 2019 at 2:06 pm
I have not heard anything about being able to do this ... but then again, I've never lived anywhere where the standard Gregorian (not English - more like Italian!) calendar is not in place.
Based on that limited knowledge, I'd be tempted to create a lookup table, something like this
CREATE TABLE DateLookup(GregorianDate Date NOT NULL PRIMARY KEY CLUSTERED, NepalDate CHAR(8) NOT NULL)
The CHAR(8) is a guess ... use whatever works.
Populate this table for the entire date range you're interested in. This is now static data.
In your various tables, use standard SQL Server DATE data types. Whenever you need to display dates in the Nepalese format, use the new lookup table.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply