Cookie control banner

We use cookies to ensure our website works properly, deliver personalised advertising, and collect usage statistics to help us improve the website. You may change your settings at any time or accept the default settings. For more information, please refer to our privacy policy.
Skip to main content

The DateRange type represents a start and end point in time.

Properties

Name Type Description
From DateTime? The date and time the range starts.
To DateTime? The date and time the range ends.

Constructor

Syntax

C#
public DateRange(DateTime from, DateTime to)
{
}

Parameters

from

Type: DateTime
The date and time the range starts.

to

Type: DateTime
The date and time the range ends.

Validation

The From value cannot be a later date than the To value.

Examples

Get a DateRange field object

C#
// Get the field value as a DateRange instance.
DateRange filmingPeriod = movieEntry.Get<DateRange>("filmingPeriod");

// Get the field value as a dynamic object (ExpandoObject).
dynamic filmingPeriod = movieEntry.Get("filmingPeriod");

Set a DateRange field object

C#
// Set the field value.
movie.Set("filmingPeriod", filmingPeriod);

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request