Function __global->date_range

Definitions

sources/calendar.php

  • Create a neatly human-readable date range, using various user-friendly readability tricks.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$from TIME No No required parameter N/A N/A From time in user time
$to ?TIME No No required parameter N/A N/A To time in user time (null: no actual to time)
$do_time boolean No No True N/A N/A Whether time is included in this date range
$force_absolute boolean No No False N/A N/A Whether to force absolute display
$timezone string No No Blank (empty string) N/A N/A Display timezone

Returns

  • Textual specially-formatted range
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Create a neatly human-readable date range, using various user-friendly readability tricks.
 *
 * @param  TIME $from From time in user time
 * @param  ?TIME $to To time in user time (null: no actual to time)
 * @param  boolean $do_time Whether time is included in this date range
 * @param  boolean $force_absolute Whether to force absolute display
 * @param  string $timezone Display timezone
 * @return string Textual specially-formatted range
 */

function date_range(int $from, ?int $to, bool $do_time = true, bool $force_absolute = false, string $timezone = '') : string