Search code examples
reporting-servicesssrs-2012

How to display date with Arabic numbers in SSRS reports


I need to display numbers in Arabic in a report developed in SSRS. I am able to display numbers such as 23000.00 in Arabic by setting the Language property to "ar-SA" and NumeralVariant to 3. However this doesn't work for TextBox that display date in the format dd/MM/yyyy.

Any help appreciated.


Solution

  • It appears there isn't a built in way to do this, so you have to do it manually in your dataset query. I would recommend returning both a date type and your Arabic date as a nvarchar to retain filtering and ease of date logic. If you cannot be bothered to use the below on all your dates you could wrap the replace logic into a function:

    declare @d date = '20171231';
    
    select @d as DateValue
    
        ,convert(nvarchar(10), @d,103) as StringValue
    
        ,replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(
            convert(nvarchar(10), @d,103)
            ,'0',N'٠')
            ,'1',N'١')
            ,'2',N'٢')
            ,'3',N'٣')
            ,'4',N'٤')
            ,'5',N'٥')
            ,'6',N'٦')
            ,'7',N'٧')
            ,'8',N'٨')
            ,'9',N'٩') as ArabicValue
    

    Output:

    +------------+-------------+-------------+
    | DateValue  | StringValue | ArabicValue |
    +------------+-------------+-------------+
    | 2017-12-31 | 31/12/2017  | ٣١/١٢/٢٠١٧ |
    +------------+-------------+-------------+