webCOMAND

time::string_to_int()

Convert a string describing the time in any format recognized by strtotime() to Unix time.

Prototype

long static string_to_int(string $time)

Parameter

  • time - String containing the time in in any format recognized by strtotime().

Return

Long integer in Unix Time if the time was valid.  Otherwise FALSE.

Example

use \io_comand_util\time;

// output like: 10/6/2018 12:15
$unix_time = time::string_to_int('yesterday');
$formatted = date('d/m/Y H:i', $unix_time);
echo("Yesterday: $formatted\n");