以星期日為一周起始,函式傳入年份及第幾周,函式傳出開始及結束日期。
function findWeekPeriod( $week, $year )
{
$aPeriod = array();
$first_day = strtotime($year."-01-01");
$is_week_first_day = date("w", $first_day) == 0;
$is_weekone = strftime("%V", $first_day) == 1;
if($is_weekone)
{
$week_one_start = $is_week_first_day ? strtotime("last sunday",$first_day) : $first_day;
}
else
{
$week_one_start = strtotime("next sunday", $first_day);
}
$aPeriod['start'] = date("Y年m月d日", $week_one_start+(3600*24*7*($week-1)) );
$aPeriod['end'] = date("Y年m月d日", $week_one_start+(3600*24*(7*$week-1)) );
return $aPeriod;
}
例如…
$week=date('W');
$year=date('Y');
$wPeriod=findWeekPeriod( $week, $year );
/// 傳回當周的起始結束日期。
2010年1月12日 星期二
訂閱:
張貼留言 (Atom)
VirtualBox 空間減肥
sdelete64 -z c: VBoxManage modifymedium disk "/Users/fellow/VirtualBox VMs/Win10/Win10.vdi" --compact *.vdi 路徑可以在 VirtualBox 儲...
-
https://github.com/ljean/modbus-tk/ install pip… sudo apt-get install python-pip install... download modbus_tk-x.x.x.tar.gz tar zxvf...
-
set0 bit 位元設0 set1 bit 位元設1 tog bit 位元0/1切換 swapc bit 位元與c切換 =================== call addr 呼叫副程式 goto addr 跳躍到標籤 icall [index] 呼叫指標指到的副程式 ig...
-
ARis... ARis 是日本一間公司出品的產品,應用了 ARToolKit 技術。 展示影片在這… http://www.youtube.com/watch?v=yCCx7zANsGE YouTube上可以找到更多類似的影片。 這邊是我用 FLARToolK...
沒有留言:
張貼留言