Forums - C# Corner

Forum guidelines
Amit Joshi

Amit Joshi

  • 1.7k
  • 30
  • 484

How can I get a date in yyyy-mm-dd format (2013-10-25) in

Dec 27 2018 1:08 AM
I am writing a API client Wrapper for C# where I have to implement an interface which accepts the date as an DateTime object in 'yyyy-mm-dd' format.
 
What I have tried:
 
I have looked for lot of solutions but couldn't find one. It can be achieved by converting the DateTime to string but I need it as DateTime object only.
 
With Parse and ParseExact it gives output which include time 00:00:00 also, but the requirement is only to ger 'yyyy-mm-dd' format as DateTime object. Can someone please help??
 
Thanks in Advance 

Answers (12)