Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

ActionScheduler_ListTable::human_interval( int $interval, int $periods_to_include = 2 )

Convert an interval of seconds into a two part human friendly string.


Description Description

The WordPress human_time_diff() function only calculates the time difference to one degree, meaning even if an action is 1 day and 11 hours away, it will display "1 day". This function goes one step further to display two degrees of accuracy.

Inspired by the Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/


Parameters Parameters

$interval

(Required) A interval in seconds.

$periods_to_include

(Optional) Depth of time periods to include, e.g. for an interval of 70, and $periods_to_include of 2, both minutes and seconds would be included. With a value of 1, only minutes would be included.

Default value: 2


Top ↑

Return Return

(string) A human friendly string representation of the interval.


Top ↑

Source Source

File: packages/action-scheduler/classes/ActionScheduler_ListTable.php


			


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.