首页 > 代码库 > Common Functions(1)

Common Functions(1)

1.刪除文件
WinAPI::deleteFile(str filename);

2.四捨五入
decRound()

3.獲取當前時間:
stTime=dateTimeUtil::utcNow();
dateTimeUtil::date(2013-02-02 12:01)=2013-02-02

4.query加了日期过滤条件以后,怎么知道过滤了多少条数据啊
sysQuery::countTotal()是记录数
SysQuery::countLoops()是查询循环次数
num=sysQuery::countTotal(custTable_ds.queryRun());

5.輸出信息
throw error(strfmt("123123")) ;
ret=checkFailed("asf");
box::info("123");
return checkFailed(strfmt("该用户不能批准"));

6.获得两个时间差
DateTimeUtil::getDifference(datetime[1],datetime[2])/60)

7.例如: 2012-2-21 08:04:06 , 最后得到的是一个字符串是 20120221080406
str a
info(strfmt(‘utc:%1‘,DateTimeUtil::utcNow()));
a = DateTimeUtil::toStr(DateTimeUtil::utcNow());
a =strKeep(a,‘0123456789‘);
info(strfmt(‘strutc:%1‘,a));

8.获取图标
from : tutorial_Resources (aot-menus-equipment-设置-NormalResource > 在from中取数)

9.两个日期间隔函数
static int MthDiff1(date d1, date d2)
{
int daysDiff = d1 - d2 - 1;

if (daysDiff >= 0)
return (year(num2date(daysDiff)) - 1900)*12 + mthofyr(num2date(daysDiff));
else
return -1 * (year(num2date(-1 * daysDiff)) - 1900) * 12 + mthofyr(num2date(daysDiff)) ;
}
static int MthDiff2(date d1, date d2)
{
;
return year(d1) * 12 + mthofyr(d1) - year(d2) * 12 - mthofyr(d2) ;
}

10.date转str
Date2strusr(date date);