Get the time of day for the current DateTimeOffset object in CSharp
Description
The following code shows how to get the time of day for the current DateTimeOffset object.
Example
using System;//from w w w . j a va 2 s . c o m
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset currentDate = new DateTimeOffset(2014, 5, 10, 5, 32, 16,
DateTimeOffset.Now.Offset);
TimeSpan currentTime = currentDate.TimeOfDay;
Console.WriteLine("The current time is {0}.", currentTime.ToString());
}
}
The code above generates the following result.