Date Field
DateField is a Field element that can display a date, a time, or both, depending on the format you specify in a date-time picture switch.
Field Syntax
This is how the syntax of a Date field looks like:
Syntax |
---|
{ DATE [ \@ "Date-Time Picture"] [Switches] } |
Switches
Switches are a way for the code fragment to specify formatting for the result of the field. More information is available in the Syntax and Switches section of the Fields article.
The possible switches for a Date field are:
Switch | Description |
---|---|
\@ "Date-Time Picture" | Specifies a date format if different than the default format. |
Inserting
Inserting a Date Field is easily achieved through the RadFlowDocumentEditor's InsertField() method. It accepts code as first argument and result as second argument.
Example 1 demonstrates how you can insert a date field.
Example 1: Insert date field
editor.InsertField(@"DATE \@ ""dd / MM / yyyy""", "«to be updated»");
After updating the field the result would be "12/03/2021" (check Updating Fields).