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 222 views
1 answer 206 views
1 answer 201 views
4 answers 254 views
254 views asked Jan 18, 2017 by avibootz
1 answer 169 views
...