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 158 views
2 answers 212 views
1 answer 136 views
136 views asked Jun 12, 2020 by avibootz
1 answer 167 views
1 answer 78 views
1 answer 138 views
138 views asked Jun 12, 2020 by avibootz
1 answer 117 views
...