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




git-svn-id: https://develop.svn.wordpress.org/trunk@33698 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Aaron Jorbin
2015-08-21 18:15:52 +00:00
parent e4f8047716
commit 3b24c024b5

View File

@@ -95,12 +95,21 @@ function wp_initial_constants() {
// Constants for features added to WP that should short-circuit their plugin implementations
define( 'WP_FEATURE_BETTER_PASSWORDS', true );
// Constants for expressing human-readable intervals
// in their respective number of seconds.
/**
* Constants for expressing human-readable intervals
* in their respective number of seconds.
*
* Please note that these values are approximate and are provided for convenience.
* For example, MONTH_IN_SECONDS wrongly assumes every month has 30 days and
* YEAR_IN_SECONDS does not take leap years into account.
*
* If you need more accuracy please consider using the DateTime class (http://php.net/manual/class.datetime.php).
*/
define( 'MINUTE_IN_SECONDS', 60 );
define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS );
define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS );
define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS );
define( 'MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS );
define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
}