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}, LOCAL)


This example will convert a text containing date information into a valid timestamp.





UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
text
Page properties
hiddentrue
Status
Tech review

Status
titletodo

Style guide

Status
titletodo

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged

Page properties
hiddentrue
Short description

Returns a 

Status
subtletrue
titlenumber
with the date-time represented by string s

Output

Status
subtletrue
titlenumber

UI Text Box
sizemedium
typeinfo
Returns a 

Status
subtletrue
title

number with the date-time represented by string s. The numeric value returned corresponds to the milliseconds elapsed since January 1, 1970, 00:00:00 GMT

text

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

UI Text Box
typenote

Valid input string formats are

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

Also formats relative to the current time like in JQL queries: "w" (weeks), "d" (days), "h" (hours) or "m" (minutes), or

format stringToDate(string s,

formats defined at system property jira.date.time.picker.java.format are valid.

Code Block
languagebash
titleSyntax
linenumberstrue
ui-expand


timeZone
time_zone) #Output: Number
UI Expand
titleExamples

For a detailed example, check the following page : Validation based on a Date type Project Property

titleAdditional information

Parameters used in this function

nopanel

ParameterInput (data type)Description
<timestamp>

Status
subtletrue
title

data typeParameter description. timeZone

status
subtletrue
titletimezone

The time zone used for the calculation. 

Expand
titleLearn more about timezones
Excerpt Include
Dates, times and time zonesDates, times and time zonestrue<parameter>
Status
subtletrue
titledata type
Parameter description.


UI Text Box
typetip

Work days 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

The This function returns a

Status
subtletrue
titlenumber




UI Text Box
sizemedium
typeinfo

The function returns a 

Status
subtletrue
titlenumber
with Variant where you can manually define the date-time represented by string s. Expected format of value at parameter "s" is defined by date_time_pattern string parameter. The numeric value returned corresponds to the milliseconds elapsed since January 1, 1970, 00:00:00 GMT.pattern. Read more about date-time patterns.


Code Block
languagebash
titleSyntax
linenumberstrue
stringToDate(string stext, string date_time_pattern dateTimePattern ) #Output: Number


UI Expand
titleExamples


Parser expressionDescription


Code Block
languagebash
linenumberstrue
stringToDate("
2011
2020.03.25 at 11:30:00", "yyyy.MM.dd 'at' HH:mm:ss")
The function


This example returns a

Status
subtletrue
titlenumber

timestamp representing a date-time value

that can be used for setting a Date Time picker custom field

.




UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
<parameter>text

Status
subtletrue
titletextdata type

Parameter description.The parameter must contain data in a specific format. Usually this value is retrieved from a field.
dateTimePattern<parameter>

Status
subtletrue
titledata typetext

Manually defined date-time pattern. Read more about date-time patternsParameter description.



UI Expand
titleOutput
The This function returns a
Status
subtletrue
titleNumber




UI Text Box
sizemedium
typeinfo

The function returns a 

Status
subtletrue
titlenumber
with the date-time represented by string s. Expected format of value at parameter "s" is defined by date_time_pattern string parameter for a specific language (language code ISO 639-2 ) and country (country code ISO 3166 alpha-2 ). The numeric value returned corresponds to the milliseconds elapsed since January 1, 1970, 00:00:00 GMT.Variant where you can additionally define a language and a country


Code Block
languagebash
titleSyntax
linenumberstrue
stringToDate(string stext, string date_time_pattern , stringdateTimePattern, language , string country ) #Output: Number


UI Expand
titleExamples


Parser expressionDescription


Code Block
languagebash
linenumberstrue
stringToDate("Dec 7, 
2016
2020 2:10:25 AM PST", "MMM d, yyyy h:mm:ss a z", "eng", "US")
The function returns a
Status
subtletrue
titleNumber
representing a date-time value that can be used for setting a Date Time picker custom field


This example returns a timestamp based on the parameters provided.



UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
<parameter>
text

Status
subtletrue
titletext

data type
The parameter must contain data in a specific format. Usually this value is retrieved from a field.
dateTimePattern
Parameter description. <parameter>

Status
subtletrue
title

data type

Parameter description.

<parameter>

text

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

language

Status
subtletrue
title

data typeParameter description.<parameter>

text

Define the language for the conversion. Valid input parameters can be found here: ISO 639-2
country

Status
subtletrue
title

data typeParameter description.

text

Define the country for the conversion. Valid input parameters can be found here: ISO 3166 alpha-2



UI Expand
titleOutput

The This function returns a

Status
subtletrue
titleNumber


UI Text Box
typetip

This function is mostly used when you want to write the output into a Jira date-time picker.

If you want to convert a date into a text you might want to have a look at the function dateToString().



Image AddedUse cases and examples

Page properties report
firstcolumnUse case
headingsJWT feature, Workflow function, Field type, Automated action, Parser functions
cqllabel = "parser_func_stringtodate" and space = currentSpace()


Page properties
hiddentrue
id1


Parser function cloudstringToDate()
Map(tick)
Notes




Page properties
hiddentrue



Status
Tech review

Status
colourGreen
titledone

Style guide

Status
colourGreen
titledone

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged



Page properties
hiddentrue


Short description

Converts a text into a date.

Output

Status
subtletrue
titlenumber

Available since

Status
subtletrue
colourBlue
title2.2.29

Label