一,写一个辅助类,将该方法设为静态,先装换为object,在转为DateTime,返回DateTime
public class DateTimeHelper
{
public static DateTime ToDateTime(object time)
{
DateTime dt;
DateTime.TryParse(Convert.ToString(time),out dt);
return dt;
}
}
二,SqlDecimal ,decimal 装换为string时去掉0的写法
SqlDecimal de2 = 0.56000000M;
decimal de = 15.56000000M;
string str1 = de2.ToString().TrimEnd('.', '');
string str2 = de.ToString().TrimEnd('.', '');