WordPress.org

Make WordPress Core

Changeset 33698


Ignore:
Timestamp:
08/21/2015 06:15:52 PM (4 years ago)
Author:
jorbin
Message:

Add new constant MONTH_IN_SECONDS and expand time convenience documentation.

The "month" isn't really a month. It's a WordPress Month. As the docs make clear, it's not about accuracy as much as it about convenience. This adds a missing step in the time convenience constants.

Props egill
Fixes #33397

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-constants.php

    r33023 r33698  
    9696    define( 'WP_FEATURE_BETTER_PASSWORDS', true );
    9797
    98     // Constants for expressing human-readable intervals
    99     // in their respective number of seconds.
     98    /**
     99     * Constants for expressing human-readable intervals
     100     * in their respective number of seconds.
     101     *
     102     * Please note that these values are approximate and are provided for convenience.
     103     * For example, MONTH_IN_SECONDS wrongly assumes every month has 30 days and
     104     * YEAR_IN_SECONDS does not take leap years into account.
     105     *
     106     * If you need more accuracy please consider using the DateTime class (http://php.net/manual/class.datetime.php).
     107     */
    100108    define( 'MINUTE_IN_SECONDS', 60 );
    101109    define( 'HOUR_IN_SECONDS',   60 * MINUTE_IN_SECONDS );
    102110    define( 'DAY_IN_SECONDS',    24 * HOUR_IN_SECONDS   );
    103111    define( 'WEEK_IN_SECONDS',    7 * DAY_IN_SECONDS    );
     112    define( 'MONTH_IN_SECONDS',  30 * DAY_IN_SECONDS    );
    104113    define( 'YEAR_IN_SECONDS',  365 * DAY_IN_SECONDS    );
    105114}
Note: See TracChangeset for help on using the changeset viewer.