謝晒的PHP網頁設計
聯絡E-mail:
sean0704@gmail.com
站內搜尋
Friday, October 2, 2015
[PHP] 兩個日期相差多少天 (使用 DateTime::diff)
PHP官網
$datetime1 = new DateTime('2009-10-11');
$datetime2 = new DateTime('2009-10-13');
$interval = $datetime1->diff($datetime2);
echo $interval->format('%R%a days');
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment