Will SQL Server supports Nepal Calendar

  • 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

     

     

  • 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

  • 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

  • Thanks for the response. But the question is not about Time it is Nepal Date & Year.

  • 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!

  • 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:

    1. Create a custom time zone in Windows.  (Now you have 2 problems)
    2. Create (or clone and fork) Sql (or Python or C# or...) to convert.  There are GitHub repos with code.  (Now you have 2 problems)
    3. Use a public API to do the conversion for you.  Does one exist?  Google didn't find one for me.
    4. Have the Nepal date passed into Sql as a parameter
    5. ???

    Do you wish to code or mash your own converter?

     

     

     

     

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • 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.

     

     

    • This reply was modified 4 years, 8 months ago by  Phil Parkin. Reason: Improve narrative

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply