How to exclude seconds from DateTime to string in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime now = DateTime.Now;

            string sec = now.ToString("s ");

            Console.WriteLine($"{sec}");
        }
    }
}


/*
run:
 
53

*/

 



answered Aug 14, 2018 by avibootz

Related questions

1 answer 169 views
2 answers 226 views
1 answer 145 views
145 views asked Jun 12, 2020 by avibootz
1 answer 182 views
1 answer 91 views
1 answer 150 views
150 views asked Jun 12, 2020 by avibootz
...