Common Functions(1)

來源:互聯網
上載者:User

標籤:os   io   strong   檔案   資料   ar   cti   時間   

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);

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.