I came across some notation in an interpolated string currentDate:d in the Microsoft documentation but they do not elaborate on how it works or what it is called, so I don't know how to look it up further. It appears to deconstruct a DateTime and get the date and time specifically, and only seems to work in the interpolated string; I can't use the same trick to pull the time out into a variable. I'm wondering if I can use that notation for other objects and how it works.
var currentDate = DateTime.Now;
var time = currentDate:t; // this throws error
Console.WriteLine($"{Environment.NewLine}It is currently {currentDate:d} at {currentDate:t}!");
outputs:
It is currently 2021-10-31 at 10:41 AM!
MS docs source: https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code?pivots=dotnet-5-0
I can't think of a better way to ask this question, so would appreciate a hint.