php date日期函式之日期增減用法

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

php date日期函式之日期增減用法

文章 yehlu »

http://phpwrite.blogspot.com/2011/01/php-date.html

代碼: 選擇全部

# currentDate = date("Y-m-d");// current date  
# echo "Current Date: ".$currentDate."<br>";  
#   
# $date30DaysAdded = date('Y-m-d', strtotime("+30 days"));  
# echo "30 Days added: ".$date30DaysAdded."<br>";  
#   
# $date10YearsBack = date('Y-m-d', strtotime("-10 years"));  
# echo "10 Years back: ".$date10YearsBack."<br>";  
#   
# $date2DaysAdded = date('Y-m-d', strtotime("+2 days"));  
# echo "2 Days Added: ".$date2DaysAdded."<br>";  
回覆文章

回到「PHP」