PHP gets yesterday timestamp, the current time information array, last week and last week in which year, last month and last month in which the year

Source: Internet
Author: User
Tags date time stamp
/** * Gets the current time information array * @params void * @return array */function get_current_time_array () {$date = Strtotime   (Date (' y-m-d '));             Date time stamp $week = (int) date (' W ');            The first week of the Year $month = (int) date (' n ');             Month $year = (int) date (' Y '); Year $time _array = Array (' date ' = = $date, ' Week ' = $week, ' month ' = $month, ' Ye Ar ' = $year,);} /** * Get yesterday timestamp * @params void * @return int */function get_prev_day () {return strtotime (date (' y-m-d ', Strtotime (' Last Da Y ')); 
or return Strtotime ("-1 Day", Date ("y-m-d"));} /** * Get last week's year with last week * @params void * @return array */function get_prev_week () {    return array (        ' Week ' = = (int) Date (' W ', Strtotime (' Last week '),        "Year" = = (int) date (' Y ', Strtotime (' last week ')),    ); /** * Get last month's year with last month * @params void * @return array */function get_prev_month () {    return array (        ' month ' = = (int) da Te (' n ', Strtotime (' last month ')),        ' year ' = = (int) date (' Y ', Strtotime (' last month '))    ;}

The above describes the PHP get yesterday timestamp, the current time information array, last week and last week in the year, last month and last month in the year, including the content, want to be interested in the PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.