>  기사  >  백엔드 개발  >  php getdate函数用法举例

php getdate函数用法举例

WBOY
WBOY원래의
2016-07-25 08:57:351302검색
  1. $a = getdate();
  2. printf('%s %d, %d',$a['month'],$a['mday'],$a['year']);
  3. ?>
复制代码

2,getdate()使用指定的timestamp

  1. $a = getdate(163727100);
  2. printf('%s %d, %d',$a['month'],$a['mday'],$a['year']);
  3. ?>
复制代码

3,getdate()获取当前日期

  1. getdate()获取当前日期-bbs.it-home.org
  2. $date_array = getdate();
  3. foreach ( $date_array as $key => $val ) {
  4. print "$key = $val
    ";
  5. }
  6. ?>

  7. print "Today's date: ";
  8. print $date_array['mon']."/".$date_array['mday']."/".$date_array['year'];
  9. ?>
  • 复制代码

    附,getdate( )函数的返回值的对应关系

    Key Value seconds Seconds minutes Minutes hours Hours mday Day of the month wday Day of the week, numeric (Sunday is 0, Saturday is 6) mon Month, numeric year Year, numeric (4 digits) yday Day of the year, numeric (e.g., 299) weekday Day of the week, textual, full (e.g., "Friday") month Month, textual, full (e.g., "January") 0 Seconds since epoch (what time( ) returns)


    성명:
    본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.