-2
我正在開發一個使用PHP(Codeigniter)的Web應用程序。 當用戶在應用程序中請求某個資源時,我需要檢查當前日期是在本月25日之前還是之後。我怎樣才能做到這一點?我不知道怎麼做。檢查日期是在同一個月的某個日期之前還是之後
我正在開發一個使用PHP(Codeigniter)的Web應用程序。 當用戶在應用程序中請求某個資源時,我需要檢查當前日期是在本月25日之前還是之後。我怎樣才能做到這一點?我不知道怎麼做。檢查日期是在同一個月的某個日期之前還是之後
這應該這樣做...
if (date('j') < 25) {
// date before 25th
}
您可以使用date
功能與j
格式類型爲
if (date('j') > 25) {
// It is after the 25th
} elseif (date('j') < 25) {
// It is before the 25th
} else {
// It is the 25th
}
目前已經很多關於PHP日期的問題。如果你谷歌它,你會在前兩頁得到答案。 – Robik
@Donut仇恨會討厭,這個網站是爲了幫助不討厭 – Petah
@Petah這個網站是不是爲重複。 http://stackoverflow.com/faq#close – Robik