首页 > 代码库 > add month/year to drop-down list box
add month/year to drop-down list box
add month/year to drop-down list box
drop-down list添加日期
/* Add Month/Year to Card Expriry Month*/
Local Field &fld = GetField();
Local date &curDate = %Date;
Local date &endDate = AddToDate(&curDate, 5, 0, 0);
Local string &monYear;
&fld.ClearDropDownList();
/*
Local number &num = 1;
While &curDate <= &endDate
Local string &i = NumberToDisplayString("%", &num);
&monYear = DateTimeToLocalizedString(&curDate, "MMM/y");
&fld.AddDropDownItem(&i, Rept(Char(9), &num) | &monYear);
&curDate = AddToDate(&curDate, 0, 1, 0);
&num = &num + 1;
End-While;
*/
Local array of string &aryS_MthYr = CreateArrayRept("", 0);
While &curDate <= &endDate
/*y一定要小写,大写就不是"2017"这样的格式了,暂时不知原因,求解*/
&monYear = DateTimeToLocalizedString(&curDate, "MMM/y");
&aryS_MthYr.Push(&monYear);
&curDate = AddToDate(&curDate, 0, 1, 0);
End-While;
Local array of number &aryNbr_TabNumber = CreateArrayRept(0, 0);
Local number &nbrMaxValue = http://www.mamicode.com/&aryS_MthYr.Len;
Local number &n;
For &n = 1 To &aryS_MthYr.Len
&aryNbr_TabNumber.Push(&nbrMaxValue);
Local string &i = NumberToDisplayString("%", &n);
&fld.AddDropDownItem(&i, Rept(Char(9), &aryNbr_TabNumber [&n]) | &aryS_MthYr [&n]);
&nbrMaxValue = http://www.mamicode.com/&nbrMaxValue - 1;
End-For;
add month/year to drop-down list box
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。