I want to store PHP\'s microtime as my timestamp in MySQL.
I\'ve been told it\'s best to store it in DECIMAL
, but I can\'t find an ideal size.
Does
That depends on the precision you need. If milliseconds are enough for you, and you don't expect any runtimes larger than 999999 seconds you could use DECIMAL(10,4)
. You can fit it to your needs this way.
About the theoretical maximum, it is limited by the size of a float
on your system (32bit, 64bit). See PHP Float for details. But as I said, that is theoretical. No timer will give you the time in that precision.