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 164 views
2 answers 222 views
1 answer 143 views
143 views asked Jun 12, 2020 by avibootz
1 answer 175 views
1 answer 86 views
1 answer 147 views
147 views asked Jun 12, 2020 by avibootz
1 answer 125 views
...