DateTime?格式化输出
2014-12-31 15:25:20 访问(1662) 赞(0) 踩(0)
/// <summary>
/// DateTime?格式化输出
/// </summary>
/// <param name="theValue"></param>
/// <returns></returns>
public string DateTimeNullFormatDefault
(
DateTime? dtValue,
string strFormat
)
{
if (dtValue == null)
return "";
DateTime theValue = (DateTime)dtValue;
if (strFormat == null || strFormat.Length == 0)
{
if (DateTimeFormatShowSecond)
return theValue.ToString("yyyy-MM-dd HH:mm:ss");
else
return theValue.ToString("yyyy-MM-dd HH:mm");
}
else
return theValue.ToString(strFormat);
}
标签:
DateTime?格式化输出 


上一条:
下一条:
相关评论
发表评论