webCOMAND

time::format_timestamp_short()

Format a time into the short webCOMAND time format.  The time can be expressed as a database timestamp, Unix time or any format recognized by strtotime().

Prototype

string static format_timestamp_short(mixed $time, string $invalid = 'never')

Parameter

  • time - A time expressed as a database timestamp, Unix time or any format recognized by strtotime().
  • invalid - String to display if a "zero" or invalid timestamp is provided.

Return

String the standard webCOMAND format, which is M/D/YYYY H:M(am|pm) by default but can be customized in config.php.

Example

use \io_comand_util\time;

// output like: Current time: 10/6/2018 10:14pm
$now = time::get_time();
$formatted = time::format_timestamp_short($now);
echo("Current time: $formatted\n");