//SourceValue = "2006-09-31T00:00:00Z"
using Automapper;
public class DateTimeTypeConverter : ITypeConverter<string,DateTime>
{
public DateTime Convert(ResolutionContext context)
{
return System.Convert.ToDateTime(context.SourceValue);
}
}
When Automapper maps String to DateTime exception throws with only specific string i.e., 2006-09-31T00:00:00Z
sukumarraju
All-Star
16985 Points
3001 Posts
The DateTime represented by the string is not supported in calendar System.Globalization.Gregoria...
Feb 04, 2013 05:51 PM|LINK
public class DateTimeTypeConverter : ITypeConverter<string,DateTime> { public DateTime Convert(ResolutionContext context) { return System.Convert.ToDateTime(context.SourceValue); } }When Automapper maps String to DateTime exception throws with only specific string i.e., 2006-09-31T00:00:00Z
other string to Date conversion works fine.
Help appreciated.
Application Architecture Guide 2.0
My Blog
Twitter
Rion William...
All-Star
27896 Points
4618 Posts
Re: The DateTime represented by the string is not supported in calendar System.Globalization.Greg...
Feb 04, 2013 07:11 PM|LINK
The reason that this isn't working is because the Date that you are using :
is not a valid DateTime, as September cannot ever have 31 days. (30 Days hath September...)
sukumarraju
All-Star
16985 Points
3001 Posts
Re: The DateTime represented by the string is not supported in calendar System.Globalization.Greg...
Feb 04, 2013 08:39 PM|LINK
How come this is missed?
Thanks Ron.
Application Architecture Guide 2.0
My Blog
Twitter