Author : Admin

How to display DateTime up to Milliseconds?


We can use Format string "ffff" to display Date Time with millisecond.

string myDateTime = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss:ffff");
Console.WriteLine(myDateTime);

It will display the Date time with millisecond.

yyyy : year
MM : month 
dd  :  day
HH : hour
mm : minute
ss   : second
ffff   : millisecond