Skip to content

EvaluateDateTime

Returns the date-time offset value of the current node.

1
myXml.EvaluateDateTime():( DateTimeOffset | null )

Returns the date-time offset value of the node selected by the specified XPath expression.

1
myXml.EvaluateDateTime(xpath: string):( DateTimeOffset | null )

Parameters

string xpath
    The XPath expression to evaluate. If not specified, the current node is used.

Returns

The date-time offset value of the selected node.

Remarks

The difference between $Xml.Evaluate and $Xml.EvaluateDateTime when both are used on a date-time value is:

  • $Xml.EvaluateDateTime returns an object and returns NULL when there is no actual value;
  • $Xml.Evaluate returns a string and returns an empty value (but not NULL) when there is no actual value.

Examples

Read the date-time value of a selected node

1
var dueDate = $Xml.SelectSingle('DueDate').EvaluateDateTime();

Read a date-time value and handle a missing value

1
2
3
4
5
var dueDate = $Xml.EvaluateDateTime('DueDate');

if (dueDate === null) {
    $Xml.SetValue('DueDate', $Calendar.AddDays($Calendar.Today, 7));
}

See Also