0

PHP strtotime gives unix timestamp, but how to get the nanosecond timestamp in unix epoch. I want to get it to store it in my influxdb.

Jagrati
  • 11,474
  • 9
  • 35
  • 56

1 Answers1

1

PHP does not provide a function that has higher precision than microseconds, unfortunately. The UNIX timestamp, according to the standard, is stored in microseconds.
However, there is a platform-dependent solution. Use

system('date %N');

on a linux machine. See man date or this page for more info.

sx107
  • 309
  • 3
  • 11