Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
UI Text Box
sizemedium
typeinfo

This function converts a text with a certain format into a timestamp.

Code Block
languagebash
titleSyntax
linenumberstrue
stringToDate(text, timeZone) #Output: Number
UI Expand
titleExamples
Parser ExpressionDescription
Code Block
languagebash
linenumberstrue
%{stringToDate(%{issue.cf10002}, RUN_AS_LOCAL)}

This example will convert a text containing date information into a valid timestamp. The configured run-as user's timezone is used for conversion.



UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
text

Status
subtletrue
titletext

The parameter must contain a text in a specific format. Usually this value is retrieved from a field.

Note
typenote

Valid input string formats are: 

  • yyyy/MM/dd HH:mm
  • yyyy-MM-dd HH:mm
  • yyyy/MM/dd, yyyy-MM-dd,

Also formats defined in moment are valid.

timeZone

Status
subtletrue
titletext

The time zone used for the calculation. 

UI Text Box
typetip

Days might depend on the time zone - it might be Sunday on the west coast of the US while at the same time it's already Monday in Australia. 

UI Expand
titleOutput

This function returns a

Status
subtletrue
titlenumber


UI Text Box
sizemedium
typeinfo

Variant where you can manually define the date-time pattern. Read more about date-time patterns.

Code Block
languagebash
titleSyntax
linenumberstrue
stringToDate(text, dateTimePattern ) #Output: Number
UI Expand
titleExamples
Parser expressionDescription
Code Block
languagebash
linenumberstrue
%{stringToDate("2020.03.25 11:30:00", "yyyy.MM.dd HH:mm:ss")}

This example returns a timestamp 1583062200000 representing the given date-time value.


UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
text

Status
subtletrue
titletext

The parameter must contain a text in a specific format. Usually this value is retrieved from a field.
dateTimePattern

Status
subtletrue
titletext

Manually defined date-time pattern. Read more about date-time patterns.

UI Expand
titleOutput

This function returns a

Status
subtletrue
titleNumber

Page properties
hiddentrue
Short description

Converts a text into a date.

Output

Status
subtletrue
titlenumber