Search code examples
javascriptphpjsontimestampunix-timestamp

Which time stamp format is this 1651928421543667000


I'm using an API and it returns timestamp as 1651928421543667000, I can't find the supported format I have tried using

strtotime()
datetime() 
strftime()

in PHP any help? Thanks!


Solution

  • It's a timestamp in nanoseconds. Devs need ns precision for some low-level tasks with I/O, RAM, radio signals and etc. You can get the same value in PHP by using a command such as echo system('date +%s%N');. You can also convert ns into ms or s by using basics of metric system where nano indicates 10^-9.