formatting DateTime

ieee488 41 Reputation points
2023-07-17T19:23:41.9933333+00:00

I am getting back into VB.NET after 3 years away.

Going through the tutorials. https://learn.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio?pivots=dotnet-7-0

Where can I find the documentation that explains what

{currentDate:d}

is doing?

It is getting the date as a number, but where is this documented?

Thanks.

Developer technologies | VB
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2023-07-17T19:40:09.5133333+00:00

    In the past:

    Console.WriteLine("{0}Hello, {1}, on {2:d} at {2:t}", Environment.NewLine, name, currentDate)
    

    In modern Basic you can use the “Interpolated Strings”:

    {currentDate:d} means that the date will be displayed using the short numeric form without the time. The “d” and “t” are special strings that control the format of the output:

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.