Wednesday, June 8, 2011

Date conversion issue in BT when parsing to WCF data contract....

There are many situations in BT applications where you receive the date as “20110506” (yyyymmdd) and when you pass such date to a date time variable to a WCF reference it will throw a conversion error at .net WCF channel level which you can look into a trace log.
 
Now to overcome this, you can use below function in script fuctoid to convert it into the date format that .net understands.
 
public string MyConcat(string param1)
{
        return System.DateTime.ParseExact(param1, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture).ToString("yyyy-MM-dd");
}
 
trivedimehulk@gmail.com
 
 

No comments:

Post a Comment