Default Time Editor

The Default Time Editor can be used to change the value of time property.

Editor Definition

Name

Default Time Editor

ID

com.hybris.cockpitng.editor.defaulttime

Description

Use it to change the value of time property.

Type

java.util.Date

Author

SAP

Editor Preview

Settings

  1. For your custom widgets, you can change the default time format of the editor using the custom-attributes element in the ZUL file of your custom widget.
    • The following format codes are supported:

      Format Code

      Example (US)

      Example (German)

      short

      7:03 AM

      07:03

      medium

      7:03:47 AM

      07:03:07

      long

      7:03:47 AM PDT

      07:03:45 PDT

      full

      7:03:47 AM PDT

      7.03 Uhr PDT

      To the ZUL file of your widget, add the editor with the definition similar to the below, specifying the format code you want to have displayed:

      widgetid.zul

      <editor id="dateEditor1" type="java.util.Date" defaultEditor="com.hybris.cockpitng.editor.defaulttime">
          <custom-attributes timeFormat="short"/>
      </editor>
    • You can also define the date format with a pattern supported by java.text.SimpleDateFormat. For more details, see the Oracle documentation on the SimpleDateFormatInformation published on non-SAP site.

      To the ZUL file of your widget, add the editor with the definition similar to the below:

      widgetid.zul

      <editor id="dateEditor2" type="java.util.Date" defaultEditor="com.hybris.cockpitng.editor.defaulttime">
          <custom-attributes timeFormat="HH:mm:ss"/>
      </editor>
  2. In the already existing widgets, you can customize the default time format by adding the following code in the cockpit-config.xml file and specifying the pattern you want to have displayed in your attribute:

    cockpit-config.xml

    <editorArea:attribute qualifier="attribute's name" editor="com.hybris.cockpitng.editor.defaulttime">
        <editorArea:editor-parameter>
            <editorArea:name>timeFormat</editorArea:name>    
            <editorArea:value>medium</editorArea:value>
        </editorArea:editor-parameter>
    </editorArea:attribute>
  3. By using the selectedTimeZone setting (java.lang.String), you can define a preferred timezone. If you don't set it, the editor uses the user's timezone.