網路城邦
上一篇 回創作列表 下一篇  字體:
php data() 函式 上個年 月 日 和下一個月的 年 月 日 要怎麼寫?
2010/11/05 16:42:05瀏覽1472|回應0|推薦8
問題: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
( 興趣嗜好電腦3C )
列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=takaprog&aid=4570190