skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • AI Coding Assistants
    • Embedded Reporting
    • Document Processing Libraries
    • SSO Account Sign-in

    Web

    Kendo UI UI for Angular UI for Vue UI for jQuery KendoReact UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Telerik JustMock

    CMS

    Sitefinity

    AI Productivity Tools

    AI Coding Assistants

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    KendoReact Free VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class DateTimeInterval

Represents date time duration in days and/or months.

Inheritance
System.Object
DateTimeInterval
Namespace: Telerik.Windows.Controls.ScheduleView
Assembly: Telerik.Windows.Controls.ScheduleView.dll

Syntax

public sealed class DateTimeInterval : ValueType, IEquatable<DateTimeInterval>

Constructors

DateTimeInterval(Int32, Int32)

Initializes a new instance of the DateTimeInterval struct.

Declaration
public DateTimeInterval(int days, int months)
Parameters
System.Int32 days

The days.

System.Int32 months

The months.

DateTimeInterval(Int32, Int32, Int32)

Initializes a new instance of the DateTimeInterval struct.

Declaration
public DateTimeInterval(int days, int months, int weeks)
Parameters
System.Int32 days

The days.

System.Int32 months

The months.

System.Int32 weeks

The weeks.

DateTimeInterval(Int32, Int32, Int32, Int32)

Initializes a new instance of the DateTimeInterval struct.

Declaration
public DateTimeInterval(int hours, int days, int months, int weeks)
Parameters
System.Int32 hours

The hours.

System.Int32 days

The days.

System.Int32 months

The months.

System.Int32 weeks

The weeks.

DateTimeInterval(Int32, Int32, Int32, Int32, Int32)

Initializes a new instance of the DateTimeInterval struct.

Declaration
public DateTimeInterval(int minutes, int hours, int days, int months, int weeks)
Parameters
System.Int32 minutes

The minutes.

System.Int32 hours

The hours.

System.Int32 days

The days.

System.Int32 months

The months.

System.Int32 weeks

The weeks.

Fields

Zero

Identifies DateTimeInterval of zero duration.

Declaration
public static readonly DateTimeInterval Zero
Field Value
DateTimeInterval

Properties

Days

Gets the days.

Declaration
public int Days { get; }
Property Value
System.Int32

The days.

Hours

Gets the hours.

Declaration
public int Hours { get; }
Property Value
System.Int32

The hours.

Minutes

Gets the minutes.

Declaration
public int Minutes { get; }
Property Value
System.Int32

The minutes.

Months

Gets the months.

Declaration
public int Months { get; }
Property Value
System.Int32

The months.

Methods

ConvertToTimeSpan(DateTimeInterval)

Converts the given DateTimeInterval to TimeSpan.

Declaration
public static TimeSpan ConvertToTimeSpan(DateTimeInterval interval)
Parameters
DateTimeInterval interval

DateTimeInterval.

Returns
System.TimeSpan

TimeSpan.

Equals(Object)

Indicates whether this instance and a specified object are equal.

Declaration
public override bool Equals(object obj)
Parameters
System.Object obj

Another object to compare to.

Returns
System.Boolean

True if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(DateTimeInterval)

Indicates whether this instance and a specified DateTimeInterval are equal.

Declaration
public bool Equals(DateTimeInterval other)
Parameters
DateTimeInterval other

Another DateTimeInterval to compare to.

Returns
System.Boolean

True if other and this instance are the same type and represent the same value; otherwise, false.

FromDays(Int32)

Creates a new DateTimeInterval initializing it with given days.

Declaration
public static DateTimeInterval FromDays(int days)
Parameters
System.Int32 days

The days, which will be used to initialize the DateTimeInterval.

Returns
DateTimeInterval

A new DateTimeInterval.

FromMonths(Int32)

Creates a new DateTimeInterval initializing it with given months.

Declaration
public static DateTimeInterval FromMonths(int months)
Parameters
System.Int32 months

The months, which will be used to initialize the DateTimeInterval.

Returns
DateTimeInterval

A new DateTimeInterval.

GetApproximateTotalDays(Calendar)

Gets the approximate total days count for the specified calendar. Uses System.DateTime.Today's year for the calculate.

Declaration
public int GetApproximateTotalDays(Calendar calendar)
Parameters
System.Globalization.Calendar calendar

The calendar object.

Returns
System.Int32

Total days that this DateTimeInterval represents for the given calendar.

GetHashCode()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
System.Int32

A 32-bit signed integer that is the hash code for this instance.

Parse(String)

Constructs a new DateTimeInterval object from a string. The string should be in format like this: 12d 12m.

Declaration
public static DateTimeInterval Parse(string value)
Parameters
System.String value

A string that specifies the interval.

Returns
DateTimeInterval

A DateTimeInterval that corresponds to value.

Exceptions
System.ArgumentNullException

value is null.

System.ArgumentOutOfRangeException

value contains negative value.

System.FormatException

value is not in the correct format. The string should be in format like this: "{i}d {i}m" where {i} represents an System.Int32 number.

System.OverflowException

Given values for Days or Months in value are less than 0 and System.Int32.MaxValue.

TryParse(String, out DateTimeInterval)

Constructs a new DateTimeInterval object from a string. The string should be in format like this: 12d 12m.

Declaration
public static bool TryParse(string value, out DateTimeInterval interval)
Parameters
System.String value

A string that specifies the interval.

DateTimeInterval interval

The DateTimeInterval that will be created if the parsing is successful. If it failed the value will be Zero. This parameter is passed uninitialized.

Returns
System.Boolean

True if value was converted successfully; otherwise false. This operator returns false if value is null, has an invalid format, or the given values for Days or Months are less than 0 and System.Int32.MaxValue.

Operators

Equality(DateTimeInterval, DateTimeInterval)

Implements the operator ==.

Declaration
public static bool operator ==(DateTimeInterval self, DateTimeInterval other)
Parameters
DateTimeInterval self

The self.

DateTimeInterval other

The other.

Returns
System.Boolean

The result of the operator.

Inequality(DateTimeInterval, DateTimeInterval)

Implements the operator !=.

Declaration
public static bool operator !=(DateTimeInterval self, DateTimeInterval other)
Parameters
DateTimeInterval self

The self.

DateTimeInterval other

The other.

Returns
System.Boolean

True if self did not equals other.

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
EnumerableExtensions.ToEnumerable<T>(T)
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.