Csharp/CSharp Tutorial/Date Time/TimeSpan Parse — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 15:19, 26 мая 2010

Use the Parse() method to convert strings to TimeSpan instances: 7

<source lang="csharp">using System; class MainClas {

 public static void Main()
 {
   
   TimeSpan myTimeSpan12 = TimeSpan.Parse("1.8:10:30.1234567");
   Console.WriteLine("TimeSpan.Parse(\"1.8:10:30.1234567\") = " + myTimeSpan12);
 }

}</source>

TimeSpan.Parse("1.8:10:30.1234567") = 1.08:10:30.1234567

==Use the Parse() method to convert strings to TimeSpan instances: /td>


<source lang="csharp">using System; class MainClas {

 public static void Main()
 {
   
   TimeSpan myTimeSpan11 = TimeSpan.Parse("8:10:30");
   Console.WriteLine("TimeSpan.Parse(\"8:10:30\") = " + myTimeSpan11);
 }

}</source>

TimeSpan.Parse("8:10:30") = 08:10:30