I' like to return this short date in the US format, the current culture of my application is en-GB
, but I'd like it in en-US
.
Here's the code I have so far:
DateTime.Now.AddYears(-2).ToShortDateString();
Use .ToString()
extension method and enter the format:
DateTime.Now.AddYears(-2).ToString("M/d/yyyy");
Custom date format options are documented here: