Skip to main content
Browse Documentation

DateRange

Created by Scott Yearsley, last modified by Simon Horan on 22 Jan 2020

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

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

// 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

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