How to parse the date from a string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string s = "2019-09-07";
        
        DateTime dt = DateTime.Parse(s);
        
        Console.Write(dt.Day + " " + dt.Month + "  " + dt.Year);
    }
}



/*
run:

7 9  2019

*/

 



answered Sep 7, 2019 by avibootz

Related questions

1 answer 165 views
1 answer 165 views
2 answers 182 views
4 answers 223 views
223 views asked Jan 18, 2017 by avibootz
1 answer 95 views
...