How to find the current day of the year in PHP?

前端 未结 3 1698
悲&欢浪女
悲&欢浪女 2021-01-01 08:50

Is there a standard function in PHP that will find the day number of the year based on the current date?

Examples:

Jan 22nd = 22 
Feb 27th = 58
Mar 5         


        
相关标签:
3条回答
  • 2021-01-01 09:31

    date('z') + 1;

    0 讨论(0)
  • 2021-01-01 09:41

    Use the z format character of the date function:

     echo date('z'); // 22, based on the "current date"
    
    0 讨论(0)
  • 2021-01-01 09:45
    // get day of year for 08 aug 2008
    // result 221
    echo date("z", mktime(0,0,0,8,8,2008))+1;
    
    0 讨论(0)
提交回复
热议问题