- 取值
- 取今天日期
$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm $today = date("m.d.y"); // 03.10.01 $today = date("j, n, Y"); // 10, 3, 2001 $today = date("Ymd"); // 20010310 $today = date('h-i-s, j-m-y, it is w Day'); // 05-16-18, 10-03-01, 1631 1618 6 Satpm01 $today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // it is the 10th day. $today = date("D M j G:i:s T Y"); // Sat Mar 10 17:16:18 MST 2001 $today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:18 m is month $today = date("H:i:s"); // 17:16:18
- 取今、明、後天的秒數
$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y")); $lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); $nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y")+1);
- 取特定日期到目前的秒數
$Date_In = '2007-01-08'; echo time() - strtotime($Date_In); // Output the number of seconds between now and $Date_In
- 取今天日期
- Validation
- 判斷是否日期是否正確
if(strtotime($Date_In))
...
- 判斷是否日期是否正確
Reference
沒有留言:
張貼留言