Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I initialize a timespan with seconds

Tags:

c#

I have a variable(double) that holds a acumulation of seconds.

I would like to use timespan to format this into hours:min:seconds for display purposes, but I can't seem to find how I would assign this acumulated value to a timespace.

C# .net 2.0

like image 564
Brad Avatar asked Apr 05 '09 16:04

Brad


People also ask

How do I add time to TimeSpan?

Add() Method in C# This method is used to a get new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance. Syntax public TimeSpan Add (TimeSpan t);

What is the default value for TimeSpan in C#?

Current Selected Time Interval Time(TimeSpan?): Defines the current selection of time interval. The default value is null.


Video Answer


1 Answers

Use the TimeSpan.FromSeconds method.

like image 73
Ryan Lundy Avatar answered Sep 25 '22 15:09

Ryan Lundy