Phpgetdate function usage example

Source: Internet
Author: User
Phpgetdate function usage example

  1. $ A = getdate ();
  2. Printf ('% s % d, % d', $ a ['month'], $ a ['mday'], $ a ['Year']);
  3. ?>

2. getdate () uses the specified timestamp

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

3. getdate () obtains the current date.

  1. Getdate () get 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. ?>

Appendix: Correspondence between the return values of the getdate () function

Key Valueseconds Secondsminutes Minuteshours Hoursmday Day of the monthwday Day of the week, numeric (Sunday is 0, Saturday is 6) mon Month, numericyear Year, numeric (4 digits) yday Day of the year, numeric (e.g ., 299) weekday of the week, textual, full (e.g ., "Friday") month Month, textual, full (e.g ., "January") 0 Seconds since epoch (what time () returns)

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.