問題:http://tw.knowledge.yahoo.com/question/question?qid=1610101808207 我用 data() 函數寫出 這月份 但是如果 上個年 月 日 和下一個月的 年 月 日 要怎麼寫?
======================================== 回答與測試
今天:date('Y-m-d'),
昨天:date('Y-m-d',strtotime("-1 day"));
距今一年前的 年 月 日:date('Y-m-d',strtotime("-1 year"))
下一個月的 年 月 日:date('Y-m-d',strtotime("+1 month"))
範例執行結果:http://www.our-program.com.tw/taka/demo/1610101808207.php
|