在Crystal Report,我想格式化日期(小于10的加上0),但以下代码不行的?请各位指示。谢谢。:)
DateVar Invoice_Date = cdate(cStr({Company_Invoice_View.Invoice_Date}));
StringVar strYear = "";
StringVar strMonth = "";
StringVar strDay = "";
StringVar strYMD = "";
strYear = cstr(Year(Invoice_Date));
strMonth = cstr(Month(Invoice_Date));
if cdbl(strMonth) < 10 then
strMonth = cstr("0") + cstr(strMonth);
strDay = cstr(Day(Invoice_Date));
if cdbl(strDay) < 10 then
strDay = cstr("0") + cstr(strDay);
strYMD = strYear + "-" + strMonth + "-" + strDay;