Example of PHP getdate function usage

Source: Internet
Author: User
    1. $a = getdate ();
    2. printf ('%s%d,%d ', $a [' month '], $a [' mday '], $a [' Year '];
    3. ?>
Copy Code

2,getdate () using the specified timestamp

    1. $a = getdate (163727100);
    2. printf ('%s%d,%d ', $a [' month '], $a [' mday '], $a [' Year '];
    3. ?>
Copy Code

3,getdate () gets the current date

    1. GETDATE () Gets the current date-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. ?>
Copy Code

Attached, the corresponding relationship of the return value of the GETDATE () function

Key valueseconds secondsminutes minuteshours hoursmday Day of the Monthwday day of the week, numeric (Sunday are 0, Saturda Y is 6) Mon Month, numericyear year, numeric (4 digits) Yday Day of the year, numeric (e.g., 299) weekday Day of the week, TE Xtual, full (e.g, "Friday") month month, textual, full (e.g., "January") 0 Seconds since epoch (what time () returns)
  • 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.