Function __global->from_epoch_interval_index
Definitions
sources/temporal.php
- Convert a zero-based epoch interval index (e.g. from to_epoch_interval_index) to an epoch timestamp.In other words, add $index number of $intervals to $epoch.Note that when using Unix epoch, weeks start on a Thursday given that is when epoch starts. Set $epoch to 345600 to start on a Monday, or 259200 for Sunday.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: int
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $index | integer | No | No | required parameter | N/A | N/A | The interval index |
| $interval | ID_TEXT | No | No | required parameter | minutes, hours, days, weeks, months, years | N/A | The interval we want to use |
| $epoch | TIME | No | No | 0 | N/A | N/A | Define our own epoch relative to the Unix epoch to use in this calculation instead |
Returns
- The timestamp relative to Unix epoch
- Type: TIME
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Convert a zero-based epoch interval index (e.g. from to_epoch_interval_index) to an epoch timestamp.In other words, add $index number of $intervals to $epoch.Note that when using Unix epoch, weeks start on a Thursday given that is when epoch starts. Set $epoch to 345600 to start on a Monday, or 259200 for Sunday.
*
* @param integer $index The interval index
* @param ID_TEXT $interval The interval we want to use
* @set minutes, hours, days, weeks, months, years
* @param TIME $epoch Define our own epoch relative to the Unix epoch to use in this calculation instead
* @return TIME The timestamp relative to Unix epoch
*/
function from_epoch_interval_index(int $index, string $interval, int $epoch = 0) : int
* Convert a zero-based epoch interval index (e.g. from to_epoch_interval_index) to an epoch timestamp.In other words, add $index number of $intervals to $epoch.Note that when using Unix epoch, weeks start on a Thursday given that is when epoch starts. Set $epoch to 345600 to start on a Monday, or 259200 for Sunday.
*
* @param integer $index The interval index
* @param ID_TEXT $interval The interval we want to use
* @set minutes, hours, days, weeks, months, years
* @param TIME $epoch Define our own epoch relative to the Unix epoch to use in this calculation instead
* @return TIME The timestamp relative to Unix epoch
*/
function from_epoch_interval_index(int $index, string $interval, int $epoch = 0) : int

