quarta-feira, março 02, 2005

.NET Framework - TimeSpan

Pessoal, para jogar com datas aqui está uma hipotese

The value of an instance of TimeSpan represents a period of time. That value is the number of ticks contained in the instance and can range from Int64.MinValue to Int64.MaxValue. A tick is the smallest unit of time that can be specified, and is equal to 100 nanoseconds. Both the specification of a number of ticks and the value of a TimeSpan can be positive or negative.
A TimeSpan can be represented as a string in the format "[-]d.hh:mm:ss.ff" where "-" is an optional sign for negative TimeSpan values, the "d" component is days, "hh" is hours, "mm" is minutes, "ss" is seconds, and "ff" is fractions of a second. For example, a TimeSpan initialized to 1.0e+13 ticks represents "11.13:46:40", which is 11 days, 13 hours, 46 minutes, and 40 seconds.
Due to a varying number of days in months and years, the longest unit of time that is used by TimeSpan is the day.
This value type implements the IComparable interface.


http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpref/html/frlrfsystemtimespanclasstopic.asp

2 comentários:

Anónimo disse...

Em que solucao utilizas o TimeSpan?

Augusto

Papires disse...

Augusto, uso simplesmente na prespectiva de formatar um determinado periodo (do tipo diferença entre datas) e dar o valor já formatado sem ter que me preocupar em fazer a divisão por 1000 e 60 e 60 e 24, etc...