2

I have a clock on VB and i have got it to say the date and time but it wont show the milliseconds on the time.

time = DateTime.Now.ToString("dd/mm/yy HH:mm:ss")

So I know how to put the hours minuets and seconds but im not sure how to add milliseconds.

Please could someone help. Thank You

Nathan
  • 41
  • 5
  • 2
    Did you look at the documentation? – SLaks Mar 22 '16 at 18:41
  • 1
    I agree that for such a question, searching the web is a better idea, but there is no reason to downvote this question. The user has asked a question that fills all the criteria of a good question. Statement of problem. Included code. Included expected behaviour and desired behaviour. Just because the question is pretty basic is not a reason to downvote it. – David Wilson Mar 23 '16 at 10:56

1 Answers1

4

Use fff to represent the milliseconds.

For example:

time = DateTime.Now.ToString("dd/mm/yy HH:mm:ss.fff")

See MSDN for the possible placeholders.

NineBerry
  • 26,306
  • 3
  • 62
  • 93
  • 3
    Good solution, this will include any trailing 0's from milliseconds, if OP doesn't want trailing 0's `FFF` can be used. – Trevor Mar 22 '16 at 18:50