🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators strToDate
This page was created by Stephanie on 2025-01-09. Last edited by Wikiadmin on 2026-07-29.

You use strToDate in OCL expressions when you need to convert text to a Date value without retaining its time portion.

What strToDate does

strToDate converts a string to a Date by using the CLR System.Convert.ToDateTime() conversion and then extracting the date portion.

Use it when the source text represents a date or a date and time, but the expression should return a Date value. If the source contains a time, the returned value contains only the date portion.

For example, when a string can be converted to a CLR DateTime value that includes both a calendar date and a time, strToDate returns the calendar date and does not retain the time.

When to use it

Requirement Use
Convert text and keep both date and time strToDateTime
Convert text and return only the date strToDate
Convert text to an integer strToInt

Conversion behavior

The conversion is performed by CLR System.Convert.ToDateTime(). The input string must therefore be convertible by that method. After conversion, strToDate extracts the date portion.

Use an input date representation that is valid in the environment where the expression runs. Confirm the accepted formats and error behavior for your deployment before relying on user-entered text.

Related conversion operators

Parse is a related conversion operator. Use strToDateTime when the time portion is required by the receiving attribute or calculation.

See also