IBM Support

Extension function for time in currentTimeMillis format

Question & Answer


Question

What WebSphere DataPower extension returns the time in currentTimeMillis format?

Answer

dp:time-value( ) is the extension function that returns the current time in milliseconds.

Here is one sample, intended as an example only, using the date-time(), add(), and dp:time-value() functions:


    <xsl:template name="createtimestamp_ms">
      <xsl:variable name="timestamp" select="date:date-time()"/>
      <xsl:variable name="ZuluTime" select="date:add($timestamp,'PT0H')"/>
      <xsl:variable name="ms" select="substring(dp:time-value(),11,3)"/>
      <xsl:value-of select="concat(substring($ZuluTime,1,19),'.',$ms,'Z')"/>
    </xsl:template>
  • date-time() is an EXSLT function that gets the current date and time.
  • add() is an EXSLT function that adds a duration to a date-time
  • dp:time-value() returns the current time as the number of milliseconds since January 1, 1970

Refer to the IBM WebSphere DataPower Extension Elements/Functions Catalog for further information on these and other time and date extension functions. Be sure to consult the catalog for your appliance model and firmware version.

[{"Product":{"code":"SS9H2Y","label":"IBM DataPower Gateway"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"General","Platform":[{"code":"PF009","label":"Firmware"}],"Version":"4.0.2;4.0.1;4.0;3.8.2;5.0.0","Edition":"Edition Independent","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
08 June 2021

UID

swg21239592