SMH
SMH

Reputation: 1316

Displaying Milliseconds of the current time

I am trying to display the milliseconds of the current time on screen but I couldn't do it. I managed to show only the seconds .. any help??

My Code:

datestr(now, 'HH:MM:SS')

Upvotes: 1

Views: 568

Answers (2)

Dyrandz Famador
Dyrandz Famador

Reputation: 4525

just add 'FFF' for Millisecond in three digits

datestr(now,'HH:MM:SS.FFF') 

Upvotes: 2

TroyHaskin
TroyHaskin

Reputation: 8401

From the second-to-last row of the format out table, you need the FFF identifier:

>> datestr(now, 'HH:MM:SS:FFF')

ans =
19:35:59:476

Upvotes: 4

Related Questions