0

I cant get my head around what I am doing wrong here.

use Google\Protobuf\Timestamp;

$timestamp = new Timestamp();
$dt = Carbon::now();
$pt = $timestamp->fromDateTime($dt);

Carbon is a simple PHP API extension for DateTime so it should work but instead I get a null value for $pt

Lloen
  • 68
  • 4
  • 11

1 Answers1

0

I was doing it wrong, in case for future reference, the way is done is so:

use Google\Protobuf\Timestamp;

$timestamp = new Timestamp();
$dt = Carbon::now();
$timestamp->fromDateTime($dt);

and then use the $timestamp variable as needed.

Lloen
  • 68
  • 4
  • 11