Cuemon .NET Framework
DateSpan Structure
Members  Example 

Represents a System.DateTime interval between two System.DateTime values.
Syntax
'Declaration
 
Public Structure DateSpan 
   Inherits System.ValueType
public struct DateSpan : System.ValueType 
Example
Combine the power of a System.Timespan with the power of a System.DateTime, resulting in in a DateSpan, located in the Cuemon namespace.
In this example I will show you how to calculate an age (in this case mine) using the above mentioned structure.
using System.Diagnostics;;
using System.Globalization;;
using Cuemon;
public static class Example
{
    public static void Run()
    {
      Debug.WriteLine(Example.GetMyAge()); // writes out: My age as of May 20th 22:25:19 (GMT+2): 32 years, 0 months, 8 days, 2 hours, 55 minutes and 19 seconds.
    }

    public static string GetMyAge()
    {
      DateSpan age = DateSpan.Parse("1978-05-12T19:30:00", "2010-05-20T22:25:19");
      string message = string.Format(CultureInfo.InvariantCulture, "My age as of May 20th 22:25:19 (GMT+2): {0} years, {1} months, {2} days, {3} hours, {4} minutes and {5} seconds.",
                                    age.Years,
                                    age.Months,
                                    age.Days,
                                    age.Hours,
                                    age.Minutes,
                                    age.Seconds);
      return message;
    }
}
Inheritance Hierarchy

System.Object
   System.ValueType
      Cuemon.DateSpan

Requirements

Target Platforms: Windows 8, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DateSpan Members
Cuemon Namespace
DateSpan by REST API
TimeSpan by REST API
DateTime by REST API

 

 


| Cuemon is licensed under a The MIT License (MIT)



© 2009-2015 Weubphoria. All Rights Reserved.

Documentation made easy with Document! X by Innovasys

Send Feedback