Export (0) Print
Expand All

TimeSpan.TicksPerHour Field

Represents the number of ticks in 1 hour. This field is constant.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Const TicksPerHour As Long

The value of this constant is 36 billion; that is, 36,000,000,000.

The following code example references and displays the value of the TicksPerHour field.


' Example of the TimeSpan fields.

Module Example

   ' Pad the end of a TimeSpan string with spaces if it does not 
   ' contain milliseconds.
   Function Align(ByVal interval As TimeSpan) As String

      Dim intervalStr As String = interval.ToString()
      Dim pointIndex As Integer = intervalStr.IndexOf(":"c)

      pointIndex = intervalStr.IndexOf("."c, pointIndex)
      If pointIndex < 0 Then intervalStr &= "        "
      Align = intervalStr
   End Function

   Public Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)

      Const numberFmt As String = "{0,-22}{1,18:N0}"
      Const timeFmt As String = "{0,-22}{1,26}"

      outputBlock.Text &= _
          "This example of the fields of the TimeSpan class" & _
          vbCrLf & "generates the following output." & vbCrLf & vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Field", "Value") & vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "-----", "-----") & vbCrLf

      ' Display the maximum, minimum, and zero TimeSpan values.
      outputBlock.Text &= String.Format(timeFmt, "Maximum TimeSpan", _
          Align(TimeSpan.MaxValue)) & vbCrLf
      outputBlock.Text &= String.Format(timeFmt, "Minimum TimeSpan", _
          Align(TimeSpan.MinValue)) & vbCrLf
      outputBlock.Text &= String.Format(timeFmt, "Zero TimeSpan", _
          Align(TimeSpan.Zero)) & vbCrLf
      outputBlock.Text &= vbCrLf

      ' Display the ticks-per-time-unit fields.
      outputBlock.Text &= String.Format(numberFmt, "Ticks per day", _
          TimeSpan.TicksPerDay) & vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Ticks per hour", _
          TimeSpan.TicksPerHour) & vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Ticks per minute", _
          TimeSpan.TicksPerMinute) & vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Ticks per second", _
          TimeSpan.TicksPerSecond) & vbCrLf
      outputBlock.Text &= String.Format(numberFmt, "Ticks per millisecond", _
          TimeSpan.TicksPerMillisecond) & vbCrLf
   End Sub
End Module

' This example of the fields of the TimeSpan class
' generates the following output.
' 
' Field                              Value
' -----                              -----
' Maximum TimeSpan       10675199.02:48:05.4775807
' Minimum TimeSpan      -10675199.02:48:05.4775808
' Zero TimeSpan                   00:00:00
' 
' Ticks per day            864,000,000,000
' Ticks per hour            36,000,000,000
' Ticks per minute             600,000,000
' Ticks per second              10,000,000
' Ticks per millisecond             10,000


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft