webCOMAND

time::string_to_db()

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

Prototype

string static string_to_db(string $time)

Parameter

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

Return

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

Example

use \io_comand_util\time;

// output like: 2018-10-06 12:15:00
$timestamp = time::string_to_db('yesterday');
echo("Yesterday: $timestamp\n");