SevenShores\Hubspot\Resources\Resource::timestamp PHP Method

timestamp() protected method

Convert a timestamp or DateTime to a millisecond timestamp.
protected timestamp ( DateTime | integer | null $timestamp ) : integer | null
$timestamp DateTime | integer | null
return integer | null
    protected function timestamp($timestamp)
    {
        switch (true) {
            case $timestamp instanceof \DateTime:
                return $timestamp->getTimestamp() * 1000;
            case is_numeric($timestamp) && strlen((string) $timestamp) == 10:
                return $timestamp * 1000;
            default:
                return $timestamp;
        }
    }