Google\Cloud\GrpcTrait::formatTimestampFromApi PHP Méthode

formatTimestampFromApi() private méthode

Format a gRPC timestamp to match the format returned by the REST API.
private formatTimestampFromApi ( array $timestamp ) : string
$timestamp array
Résultat string
    private function formatTimestampFromApi(array $timestamp)
    {
        $formattedTime = (new DateTime())->setTimeZone(new DateTimeZone('UTC'))->setTimestamp($timestamp['seconds'])->format('Y-m-d\\TH:i:s');
        return $formattedTime .= sprintf('.%sZ', rtrim($timestamp['nanos'], '0'));
    }