- ⌂ time
- Methods
- Static Methods
time::db_to_int()
Convert YYYY-MM-DD HH:MM:SS format timestamp string to Unix time.
Prototype
long static db_to_int(string $timestamp)
Parameter
- timestamp - Timestamp string in YYYY-MM-DD HH:MM:SS format.
Return
Long integer in Unix Time if the timestamp was valid. Otherwise FALSE.
Example
use \io_comand_util\time;
// output like: Current time: 2018-10-06 22:14:13.245
$timestamp = time::get_timestamp();
$unix_time = time::db_to_int($timestamp);
$formatted = date('d/m/Y H:i', $unix_time);
echo("Current time: $formatted\n");