---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, Presentation Components, widgets, tags, UI components]
nav: wcp_docs
parent_url: /wcp_docs/
title: time
layout: subsection
wd_wcptag: time
---

<a id="section_N10021_N1001E_N10001"></a>
Displays a time widget. The time format depends on the default user locale. You can specify your own format with the timeFormat attribute.

<a id="section_xz1_wjc_ccb"></a>
Use `time` on:

-   An edit page when you want to enable users to input a time.
-   A view page when you want to display a time that users can't change.


The data type of the `time` widget value is Date, which includes the date, time, and time zone. For an empty value, set the value to null.

## <a id="section_zsy_dyp_ypb"></a>Example

This `time` widget displays the current time and submits it to an outbound endpoint:

```
{
  "type": "time",
  "label": "time",
  "value": "<% date:getTodaysDateFormatted(date:getDateTimeZone('America/Los_Angeles'), 'HH:mm:ss') %>",
  "valuesOut": [
    {
      "value": "<% date:format(self.value, 'HH:mm:ss') %>",
      "valueOutBinding": "aPostEndpoint.checkInTime"
    }
  ],
  "enabled": true
}
```

## <a id="section_mobileSupport"></a>Mobile Support

Android, iOS

## <a id="section_attributes"></a>Attributes

-   <b>enabled</b>

    Data type: dynamicBinding-Boolean

    If true, users can enter values on the widget. If false, users can only view the widget.

-   <b>guide</b>

    Data type: `guide`

    Displays a <b>?</b> widget that opens a popup window containing guidance information about a widget on an edit page. For details, see the `guide` tag.

-   <b>helpText</b>

    Data type: binding-String

    Text that displays when a user hovers their cursor over the widget.

    <b>Note:</b> The Chrome browser truncates the tooltip to 1400 characters.

-   <b>id</b>

    Data type: binding-String

    Unique identifier used to reference this widget from other tags.

    Notes:

    -   The `id` must start with a letter.
    -   The `id` must be unique per page.
    -   To enable other widgets to reference this widget `id`, place this widget before the other widgets on the PMD. The PMD validation returns an "Undefined variable" error if it doesn't find a previously defined `id` in the PMD.
    -   Workday recommends that you include the `id` in your tag definitions for debugging purposes.

-   <b>label</b>

    Data type: dynamicBinding-String

    Text that displays beside or above most widgets. Often used in simple widgets that include inputs.

    The maximum number of characters is 255.

-   <b>render</b>

    Data type: binding-Boolean

    If true, this tag renders as a widget on the page. If false, the loaded page doesn't add this tag or its children. The default is true.

    Unlike the `visible` attribute, when `render` is false, other tags on the page can't reference this tag or widget on edit pages. On view pages, a tag can't reference other tags regardless of the `render` attribute value.

-   <b>required</b>

    Data type: dynamicBinding-Boolean

    If true, the user must enter a value on the widget before submitting the page.

-   <b>sortOrder</b>

    Data type: binding-String

    When you set `sorted` to true on the `section` or `fieldSet` parent of this widget, the `sortOrder` attribute determines the order of this widget within its parent. The sort order is relative to the siblings of the widget.

    Typical values are "a", "b", "c", and so on. Example: The widget with `"sortOrder": "a"` displays before the widget with `"sortOrder": "b"`.

    <b>Note:</b> The `sortOrder` doesn't apply to sorting data on the widget. `sortOrder` only applies to the placement order of the widgets within the parent widget.

-   <b>timeFormat</b>

    Data type: binding-String

    The time format that the page sends to and receives from Presentation Components. Default format: `HH:mm:ss.SSS`. For valid formats, see the Java documentation for `java.text.SimpleDateFormat`.

-   <b>timeDisplayPattern</b>

    Data type: binding-String

    The time format for display purposes. This attribute applies only to read-only time format. Note that this property overrides automatic formatting based on user locale. For details about the time format, see the Java documentation for `java.text.SimpleDateFormat`.

-   <b>timePrecision</b>

    Data type: string

    The precision in the time format. The valid values are HOUR, MINUTE, SECOND, MILLISECOND.

-   <b>value</b>

    Data type: dynamicBinding-String

    The displayed value when the page renders. Users can change this value on edit pages.

    Example: You can set the `value` attribute to a value from an inbound endpoint, script, or any app variable (such as <i>queryParams.someVariable</i>). The page displays the initial value when the page loads. When the user changes this value on an edit page, it sends the `value` with `valueOutBinding` as the JSON field binding in the outbound request payload.

    <b>Note:</b> If you're using `valuesOut` instead of `valueOutBinding` as a root-level attribute, the root-level `value` is the inbound value for the page load while the `value` in `valuesOut` corresponds to the outbound value sent with the `valueOutBinding`.

-   <b>valueOutBinding</b>

    Data type: dynamicBinding-String

    A binding to the JSON field that stores the widget value in the outbound request payload.

    Example:

    ```
    {
    "type":"textArea",
    "id":"memo",
    "label":"Memo",
    "value":"<% queryParams.memo %>",
    "valueOutBinding": "expensesPostEndpoint.memo"
    }
    ```

    When the user submits the edit page, we send the request payload containing field values as specified in `valueOutBinding`.

    This sample JSON request payload contains the memo field sent to the sample `expensesPostEndpoint`:

    ```
    {"memo": "Sample value from the memo widget."}
    ```

    If you want to send an array of JSON values to the outbound endpoint, specify the path using this pattern: `anEndpointName.[].aJsonFieldName`.

    Example: To send this array to the sample outbound endpoint:

    ```
    [{"memo":"First memo"}, {"memo":"Second memo"}]
    ```

    Specify this `valueOutBinding`:

    ```
    "valueOutBinding" : "expensesPostEndpoint.[].memo"
    ```

    <b>Note:</b> If the `visible` attribute is false for this widget on an edit page, the outbound endpoint doesn't include the widget's `valueOutBinding` data in the outbound payload. To include the `valueOutBinding` data in the payload, use the `onSend` event handler.

-   <b>valuesOut</b>

    Data type: list of outValue objects

    An array of values and their bindings to JSON fields in the outbound request payload.

    An array item consists of these attributes:

    -   `value` - An object binding of the value to include in the outbound JSON.
    -   `valueOutBinding` - A string binding of the JSON field that contains the value in the request payload. We send the request payload with the outbound endpoint when the user submits the page.

    You can use `valuesOut[]` to:

    -   Send a single piece of data to multiple outbound fields or endpoints. Example: A street address persisting to a Billing Address field and a Shipping Address field or different endpoints.
    -   Apply a function to the outbound value when persisting the data. Example: Convert a date to a specific format or convert a list to a string.

    In this example, the value of the `country` widget is sent to 2 different outbound fields `shippingAddress.country` and `billingAddress.country`.

    ```
    "valuesOut": [
    {
      "value": "<% country.value[0] %>",
      "valueOutBinding": "anOutboundEndpoint.shippingAddress.country.id"
    },
    {
      "value": "<% country.value[0] %>",
      "valueOutBinding": "anOutboundEndpoint.billingAddress.country.id"
    }
    ]
    ```

    This example uses PMD functions to extract the year and month from date values, and sends them separately to the outbound endpoint:

    ```
    "valuesOut": [
    {
      "value": "<% date:month(date1.value) %>",
      "valueOutBinding": "anOutboundEndpoint.dateMonth"
    },
    {
      "value": "<% string:toString(date:year(panelList1Date1.value)) %>",
      "valueOutBinding": "anOutboundEndpoint.dateYear"
    }
    ]
    ```

    <b>Note:</b> If the `visible` attribute is false for this widget on an edit page, the outbound endpoint doesn't include the widget's `valuesOut` data in the outbound payload. To include the `valuesOut` data in the payload, use the `onSend` event handler.

-   <b>visible</b>

    Data type: dynamicBinding-Boolean

    If true, the widget generated by this tag is visible. If false, this tag and its children tags aren't visible. This tag provides the ability to display or hide the widget dynamically based on user interactions on the page. The default is true. Unlike the `render` attribute, the generated widget persists on the page even when `visible` is false.

    <b>Notes:</b>

    -   When the widget or field you’re hiding changes on the page, you must include it inside a `fieldSet`.
    -   When the `visible` attribute is false for this widget on an edit page, the outbound endpoint doesn't include the `valueOutBinding` or `valuesOut` data of the widget in the payload. To include the `valueOutBinding` or `valuesOut` data in the payload, use the `onSend` event handler.



## <a id="section_pmdScriptingEvents"></a>PMD Scripting Events

-   <b>onChange</b>

    Triggers when the user changes the value of the widget.



## <a id="section_pmdScriptingMethods"></a>PMD Scripting Methods

-   <a id="d36e373"></a><b>clearError()</b>

    Return type: `void`

    Description: Clears the validation error.

-   <a id="d36e388"></a><b>clearWarning()</b>

    Return type: `void`

    Description: Clears the validation warning.

-   <b>getLabel()</b>

    Return type: `string`

    Description: Returns the widget label.

-   <a id="d36e418"></a><b>getValue()</b>

    Return type: `Object`

    Description: Returns the value of this widget.

-   <a id="d36e433"></a><b>getValueOutBinding()</b>

    Return type: `string`

    Description: Returns the outbound value binding of this widget.

-   <b>isEnabled()</b>

    Return type: `boolean`

    Description: Returns true if this widget is enabled.

-   <b>isRequired()</b>

    Return type: `boolean`

    Description: Returns true if this widget is required.

-   <b>isUpdated()</b>

    Return type: `boolean`

    Description: If true, this widget is manually updated by the end-user.

-   <b>isUpdatedByScript()</b>

    Return type: `boolean`

    Description: If true, this widget is programmatically updated by a PMD script.

-   <b>isVisible()</b>

    Return type: `boolean`

    Description: Returns true if this widget is visible.

-   <b>setEnabled(boolean enabled)</b>

    Return type: `void`

    Description: Enables or disables this widget.

-   <a id="d36e540"></a><b>setError(String error)</b>

    Return type: `void`

    Description: Sets the validation error. The input error message displays in the page error window.

-   <a id="d36e555"></a><b>setLabel(String label)</b>

    Return type: `void`

    Description: Sets the widget label.

-   <b>setRequired(boolean required)</b>

    Return type: `void`

    Description: Makes this widget required or not required.

-   <a id="d36e585"></a><b>setValue(Object value)</b>

    Return type: `void`

    Description: Sets the value of this widget.

    For `date` widgets: When you set the value of a `date` widget to an empty value, specify `null` instead of an empty string. Example: `dateWidgetId.setValue(null)` or `dateWidgetId.value = null`.

-   <a id="d36e618"></a><b>setValueOutBinding(String valueOutBinding)</b>

    Return type: `void`

    Description: Sets the outbound value binding to this widget.

-   <a id="d36e633"></a><b>setVisible(boolean visible)</b>

    Return type: `void`

    Description: Displays or hides this widget.

    If you need to change the visibility of a widget, ensure that it's inside a `fieldSet`.

-   <a id="d36e655"></a><b>setWarning(String warning)</b>

    Return type: `void`

    Description: Sets the validation warning.



