How to parse time value from a string in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = "18:35:00 PM";

            DateTime dt = DateTime.Parse(s);

            Console.WriteLine(dt);
        }
    }
}

/*
run:
   
18/01/2017 18:35:00

*/

 



answered Jan 18, 2017 by avibootz

Related questions

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