-6

How can we obtain the current date in format yyyy.MM.dd in C# ASP.NET?

using DateTime.Now

Thomas Flinkow
  • 4,845
  • 5
  • 29
  • 65

1 Answers1

1

Simply by using

string date = DateTime.Now.ToString("yyyy.MM.dd");

See this documentation for more info on custom date and time formats.

Thomas Flinkow
  • 4,845
  • 5
  • 29
  • 65