Simply by using
string date = DateTime.Now.ToString("yyyy.MM.dd");
See this documentation for more info on custom date and time formats.
More Related Contents:
- Displaying the build date
- Change system date programmatically
- Do action until specific time in C# [closed]
- Get current date in personalized format in c#
- Calculate difference between two dates (number of days)?
- How do you convert epoch time in C#?
- Algorithm to detect overlapping periods [duplicate]
- Difference in months between two dates
- How to get only time from date-time C# [closed]
- Javascript date to C# via Ajax
- Compute the DateTime of an upcoming weekday
- How do I represent a time only value in .NET?
- How to change time in DateTime?
- Outputting Date and Time in C++ using std::chrono
- A type for Date only in C# – why is there no Date type?
- Difference between System.DateTime.Now and System.DateTime.Today
- Date difference in years using C# [duplicate]
- Count number of Mondays in a given date range
- Datetime in C# add days
- C# Datetimes: Conversion for different time zones
- Random date in C#
- How can I determine the week number of a certain date?
- Parsing a Auto-Generated .NET Date Object with Javascript/JQuery
- Cannot convert from Hijri Date to Gregorian date (c#)
- Get the exact time for a remote server
- Use SQL Server time datatype in C#.NET application?
- How do I determine if a given date is the Nth weekday of the month?
- Calculating Future Epoch Time in C#
- Specify Date format in MVC5 (dd/MM/yyyy)
- Adding Days to a Date but Excluding Weekends