首页上一页 1 下一页尾页 1 条记录 1/1页
客户编号例如:KH-20071118114255 可我执行后生成的是 YG-15072010234117 年没在最前面
发表在C#图书答疑
2010-07-15
是否精华
是
否
版块置顶:
是
否
[font color=#FF0000] #region //生成客户编号例如:KH-20071118114255 可我执行后生成的是 YG-15072010234117 要怎么改才能成前面那样年月日顺序编号呀?请老师指点一下。[/font]
public string tb_EmpInfoID()
{
int intYear = DateTime.Now.Day;
int intMonth = DateTime.Now.Month;
int intDate = DateTime.Now.Year;
int intHour = DateTime.Now.Hour;
int intSecond = DateTime.Now.Second;
int intMinute = DateTime.Now.Minute;
string strTime = null;
strTime = intYear.ToString();
if (intMonth < 10)
{
strTime += "0" + intMonth.ToString();
}
else
{
strTime += intMonth.ToString();
}
if (intDate < 10)
{
strTime += "0" + intDate.ToString();
}
else
{
strTime += intDate.ToString();
}
if (intHour < 10)
{
strTime += "0" + intHour.ToString();
}
else
{
strTime += intHour.ToString();
}
if (intMinute < 10)
{
strTime += "0" + intMinute.ToString();
}
else
{
strTime += intMinute.ToString();
}
if (intSecond < 10)
{
strTime += "0" + intSecond.ToString();
}
else
{
strTime += intSecond.ToString();
}
return ("YG-" + strTime);
}// end if
#endregion