Search code examples
t-sqldatessisdimensionspersian

Building DimDate in SSAS 2012 for Persian calendar (Shamsi or Jalali dates)


Does anybody have a script for building DimDate in SSAS 2012 for Persian calendar (Shamsi or Jalali dates)?

I found scripts for building the structure here: http://www.bidn.com/blogs/MikeDavis/ssis/1400/script-to-load-dim-date-and-dim-time

I want to know what you use to convert dates to Shamsi dates.


Solution

  • You can get date conversion script from below resources.

    [dbo].[GregorianToPersian]

    which you can use it in this syntax:

    select [dbo].[GregorianToPersian] ('2011-08-25)
    
    result: 1390-06-03
    

    SELECT dbo.getShamsiDate('20130430')

    And the result is:

    1392/02/10