Quote:
Thank you for your solution, but isn't correct.
I don't need stringDate with this format ("yyyy-MM-dd");
I need dt with this format ("yyyy-MM-dd");
I must print this
Console.WriteLine(dt); dt=1990-04-21
Tony's solution is correct - it answers the question you asked, if not the question you meant!
DateTime values don't
have a format - they are stored as a number of "ticks" since a predefined pint in time.
They only acquire a format of any kind when you convert them to a string for presentation to a user - such as when you call ToString on a DateTime variable either explicitly or implicitly. When you do that, the default Date and Time format for the system the code is running on will be used unless you explicitly supply a format string to tell it what string output you want.
See here:
Formatting a DateTime for display - format string description[
^]