Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > JavaScript API > Date Control API > Methods

JavaScript API: Date Control API > getStringValue()

Scroll Prev Next More

 

This method gets the Date control value as a string. Similar to getValue() but instead of JavaScript Date object returns a string value like 2020-07-27 13:12:11.

Syntax

ctrl.getStringValue()

Arguments

No arguments.

Return value

The date control value as a string.

Example

getStringValue() can be used in the JavaScript OnLoad event, as well as any other JavaScript event.

 

Display the the current value of the date control:

 

var ctrl = Runner.getControl(pageid, 'datefield');
var str_date = ctrl.getStringValue();
alert(str_date);

 

Note: replace "datefield" with the actual field name in the function.

See also:

JavaScript API: Control object > getControl()

JavaScript API: Date Control API > setValue()

JavaScript API: Date Control API > getMomentValue()

Date control API

JavaScript API