Date Time
- Last UpdatedJun 25, 2024
- 2 minute read
Use scripts to set and get values for the properties of the Date Time control.
Basic
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Name |
Yes Writable Readable |
To set the property control.findById("ID").tagName = "Value for Name"; To get the value of the property control.findById("ID").tagName; |
|
XML Node |
Yes Readable |
To get the value of the property control.findById("ID").xmlNodeBoundTo; |
|
Description |
Yes Writable Readable |
To set the property control.findById("ID").description = "Value for Description"; To get the value of the property control.findById("ID").description; |
|
Tooltip |
No |
Not Applicable |
|
Default Value |
Yes Readable |
To get the value of the property control.findById("ID").defaultValue; |
Appearance
|
Property |
Scripting Supported |
Script |
|---|---|---|
|
Enable |
Yes Writable Readable |
To set the property control.findById("ID").enable = true; To get the value of the property control.findById("ID").enable; |
|
Visible |
Yes Writable Readable |
To set the property control.findById("ID").visible = true; To get the value of the property control.findById("ID").visible; |
|
Read-Only |
Yes Writable Readable |
To set the property control.findById("ID").readOnly = true; To get the value of the property control.findById("ID").readOnly; |
|
Label Position |
No |
Not Applicable |
|
Label-Control Area |
No |
Not Applicable |
|
Width |
No |
Not Applicable |
|
Retain Space |
No |
Not Applicable |
|
Custom Style Sheet Identifier |
No |
Not Applicable |
Validation
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Mandatory |
Yes Writable Readable |
To set the property control.findById("ID").isMandatory = true; To get the value of the property control.findById("ID").isMandatory; |
|
Minimum Value |
Yes Writable Readable |
To set the property control.findById("ID").min = new Date("01/01/1901 00:00:00"); To get the value of the property control.findById("ID").min; |
|
Maximum Value |
Yes Writable Readable |
To set the property control.findById("ID").max = new Date("12/31/2099 23:59:59"); To get the value of the property control.findById("ID").max; |
Advanced
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
On Data Change |
Yes |
For more information, see scripting guidelines for On Data Change property. |
|
ID |
No |
Not Applicable |
|
Date Format |
No |
Not Applicable |
|
Time Format |
No |
Not Applicable |
|
Time Interval |
No |
Not Applicable |
|
Include in Summary |
No |
Not Applicable |
Scripts
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Name |
Yes |
return "Value for Name"; |
|
Description |
Yes |
return "Value for Description"; |
|
Enable |
Yes |
return true; For more information, see scripting guidelines for Enable property. |
|
Visible |
Yes |
return true; For more information, see scripting guidelines for Visible property. |
|
Read-Only |
Yes |
return false; For more information, see scripting guidelines for Read-Only property. |
|
Mandatory |
Yes |
return true; For more information, see scripting guidelines for Mandatory property. |
|
Default Value |
Yes |
return "12/31/2099 00:00:00"; Note: |
|
Value |
Yes |
return "12/31/2099 00:00:00"; Note: |
|
Validate |
Yes |
return new ValidationOptions(false, "Error Message"); OR return new ValidationOptions(true, ""); For more information, see scripting guidelines for Validate property. |
Example
If you want to show date and time in the Formatted Time (D1) Date Time control when you enter date and time in the Entered Time (T1) Text control, then you can code the script for the On Data Change event of the Entered Time (T1) Text control as follows:
// Show date and time in the Date Time control from the Text control.
// The date and time in the Text control is not converted to UTC.
var dateTime = new Date();
var dateTimeUtc = SFU.getDateTimeInServerUTCFormat(dateTime);
control.findById("D1").value=SFU.getDateTimeInStringFormat(dateTimeUtc,"MM/dd/yyyy HH:mm:ss");
Note:
- Display value is readable.
_ You can retrieve the display value via script as follows:
return control.findById("ID").displayValue;