0

if I use date('Y-m-d H:i:s.u') the output will be some thing like 2015-11-03 13:25:25.253000. But i need 2015-11-03 13:25:25.253 how I can do it?

Kalim
  • 347
  • 1
  • 7
  • 17

1 Answers1

0

Try this date('Y-m-d H:i:s'.substr((string)microtime(), 1, 4))

or what Daniel suggests in the comment down below.

link1tmk
  • 1
  • 1
  • 1
    Just for good style: you shouldn't include variable content in the format string. use `date('Y-m-d H:i:s').substr((string)microtime(), 1, 4)` instead - maybe there is once an optimizer which compiles/caches the format in advance. this will fail with variable strings – Daniel Alder Nov 03 '15 at 08:38
  • Also, Daniel's method is way faster. –  Nov 03 '15 at 08:58