getTextAsTime

getTextAsTime(): Time;

The getTextAsTime method returns the text from the textUser property of a JadeEditMask control or the text property of a TextBox control converted to a Time value.

If the mask property does not specify that the data is a time field with at least an hour and minutes mask, (for example, hh:mm) or if the time data is incomplete but not empty, an exception is raised. If the mask does not have a seconds part, the seconds part of the time is set to zero (0).

When the EnhancedLocaleSupport parameter in the [JadeEnvironment] section of the JADE initialization file on the database node is set to true, the JadeEditMask class validates the setting and entry of text based on the mask property, using the current locale of the client with regional overrides on both the presentation client and the application server.

When the EnhancedLocaleSupport parameter is not defined or it is set to false, inconsistent results could be returned to the application server when running in JADE thin client mode and there are regional overrides, as all overrides on the application server are suppressed. By default, formatting of locale data is done on the application server, based on the locale of the corresponding presentation client. For example, if the locale of your application server is set to English (United Kingdom), which has a default short time format of HH:mm:ss (24-hour clock), and it has been overridden with a short time format of hh:mm:ss (12-hour clock), this is returned in the default HH:mm:ss format.

Use the isEmpty and isValid methods to prevent incomplete time data from generating an exception.

If the text box is empty, a zero (0) time is returned. If the text is not a valid time, an exception is raised.

A JadeEditMask control or TextBox control expects times to be formatted according to the locale that the control is using (for details, see the languageId property). This applies when accessing the text or textUser property and when the user enters data.

Setting time text by using the setTextFromTime method converts the time into the appropriate string for that locale. Retrieving the Time value by using the getTextAsTime method does the reverse. You can therefore use the getTextAsTime and setTextFromTime methods to access time text so that JADE handles the locale format for you.