I am facing issue when trying to access the CLR Function from the SSRS Report when i am using NodaTime Objects in the function.
When i am calling the CLR Function from the web page its working fine but when i try to access the function from SSRS Report its Giving #error.
If will write simple text and return it the function value is displaying in the SSRS Report only when Nodatime is used that time its giving #error as output.
My DLL which is containing the function is in .net Framework 3.5 and NodaTime 1.3.4 version i am using and SSRS-2014 i am using for report.
This The CLR Function
public static string ConvertFromUTCToLocalTime()
{
//string UserDateTime,string userTimeZone,string validateFormat
//DateTime UserDateTime
// Since your input value is in UTC, parse it directly as an Instant.
var pattern = InstantPattern.CreateWithInvariantCulture("dd/MM/yyyy HH:mm");
var parseResult = pattern.Parse("31/03/2017 02:00");
if (!parseResult.Success)
return "Invalid Date time provided...";
var instant = parseResult.Value;
// You will always be better off with the tzdb, but either of these will work.
var timeZone = DateTimeZoneProviders.Tzdb["Australia/Sydney"];
// var timeZone = DateTimeZoneProviders.Bcl[userTimeZone];
// Convert the instant to the zone's local time
var zonedDateTime = instant.InZone(timeZone);
return zonedDateTime.ToString("dd-MMM-yy HH:mm", null);
}
Please help me thank you.