I am trying to integrate with some VB code that generates a string using
DateTime.Now.ToString("yyyyMMddHHmmssffff")
The closest I can get to this in PHP has been
date('YmdHis')
But this lacks the milliseconds,
I have tried playing with microtime e.g.
date('YmdHis',time()).substr(str_replace(".","",microtime(true)),10,17)
But sometimes this results in a shorter string
>Solution :
date function always returns zero for microseconds. Use DateTime -> format and chop the last two digits off so that 4 fractional digits are left.
substr((new DateTime()) -> format('YmdHisu'), 0, 18);