Convert Google.Protobuf.Timestamp to DateTime in Elixir
Here's how to convert a Google.Protobuf.Timestamp to DateTime in Elixir.
Convert your DateTime to seconds using DateTime.to_unix, then set that as the seconds field on the Timestamp struct.
Utility and a light dinner to follow:
defmodule MyApp.Common.DateTime do
  def google_timestamp(datetime) do
    if datetime do
      %Google.Protobuf.Timestamp{seconds: datetime |> DateTime.to_unix()}
    else
      nil
    end
  end
end