Design an application using methods that convert an integer number of seconds to an equivalent number of hours, minutes, and seconds. Use methods for entering the initial seconds, performing the computations, and displaying the results.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Selva GanapathyPosted Feb 26, 2014, 12:43 AM
here i a solution of c# code snippet to meet your question.
namespace Methods
{
class Program
{
static void Main(string[] args)
{
Program pgm = new Program();
Console.Write("Enter seconds value to add with current Date Time Second value : ");
pgm.calculateMethod(Convert.ToInt16 (Console.ReadLine ()));
Console.ReadLine();
}
private void calculateMethod(int second)
{
Console.WriteLine();
DateTime dateTime = DateTime.Now;
Console.WriteLine("Current DateTime Value is " + dateTime.ToString());
Console.WriteLine();
var addedDateTime = dateTime.Add(new TimeSpan(seconds: second,hours: 0, minutes: 0));
Console.WriteLine("Value added to the Current DateTime is " + addedDateTime.ToString());
Console.WriteLine();
}
}
}
Output:
Regards,
Selva Ganapathy K