Minutes To String - CSharp System

CSharp examples for System:DateTime Minute

Description

Minutes To String

Demo Code


using System.Globalization;
using System;//from w ww.j  a  v  a  2  s .  c  om

public class Main{
        public static string MinutesToStr(int minutes)
        {
            var mod = minutes % 10;
            if (mod == 0 || minutes > 10 && minutes < 20)
                return minutes + " minutes ";
            if (mod == 1)
                return minutes + " minute ";
            if (mod < 5)
                return minutes + " minutes ";
            return minutes + " minutes ";
        }
}

Related Tutorials