Function: timestamp()

function timestamp(string $time_string, string $format): int|string|null;

Converts the string representing the date/time in the specified format to the timestap.

Parameters

Name Pass type Value type Default value Description
$time_string by value string

The date/time string.

$format by value string

The date format of the date/time string in the PHP systax for the date formats, e.g. "Y.m.d H:i:s".

Returns

int|string|null

If the date/time string could be converted, the timestamp is returned, otherwise the string "error" is returned.

Authors

Oleg Schildt

Package

Source code