标签:value bug net 计算 format TE oid valueof val
public with sharing class NETWORKDAY {
public void NETWORKDAY(){
//datetime s = datetime.today();
Datetime s = Datetime.newInstance(2014, 10, 22);
Datetime e = Datetime.newInstance(2014, 10, 13);
NETWORKDAY d = new NETWORKDAY();
d.diff(s,e);
}
public integer diff(Datetime sdate, Datetime edate){
integer count=0;
Date d1 = Date.valueOf(sdate);
Date d2 = Date.valueOf(edate);
integer wDay = d1.daysBetween(d2) ;
do{
if(sdate.format(‘EEEE‘) == ‘Saturday‘) {
count++;
}
if(sdate.format(‘EEEE‘) == ‘Sunday‘) {
count++;
}
sdate= sdate.adddays(1);
}while(sdate<=edate);
wDay = wDay-count+1;
system.debug(‘*************‘+wDay);
return wDay;
}
}
标签:value bug net 计算 format TE oid valueof val
原文地址:https://www.cnblogs.com/linnan/p/9130139.html