You can achieve this format in C# by using the ToString()
method on a DateTime
object with a custom format string.
main.cs178 chars4 lines
Output:
main.cs33 chars2 lines
In the format string:
MMMM
represents the full month namedd
represents the numeric day of the month (with leading zero)yyyy
represents the full yearh
represents the 12-hour clock hour (without leading zero)mm
represents the minute (with leading zero)ss
represents the second (with leading zero)fff
represents the milliseconds (with leading zeros if necessary)tt
represents the AM/PM designatorYou can find more information about custom date and time format strings in the Microsoft documentation: https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
gistlibby LogSnag