- 1. Overview
- 2. Process Functions
- 3. Task Functions
- 4. Dynaform and Field Functions
- 5. Case Functions
- 6. Case Routing Functions
- 7. Case Notes Functions
- 8. User Functions
- 9. Group Functions
- 10. Email Functions
- 11. Document Functions
- 12. Unique ID Functions
- 13. Date Functions
- 14. String Functions
- 15. Database Functions
- 16. Grid Functions
Date Functions
formatDate()
formatDate()
formats a date string according to a given date format and given language. Note that ProcessMaker stores the input in date fields in Dynaforms as strings.
Parameters:
- string date: The input date to be reformatted. The input date must be a string in the format
'yyyy-mm-dd'
or'yyyy-mm-dd h:i:s'
, such as'2015-12-31'
or'1998-02-07 22:50:08'
. This is the same format used to store dates and datetimes by the MySQL database and datetime fields in Dynaforms. - string format: The format of the date that will be returned. It can contain the following codes:
yyyy
- shows the year with four numbers (e.g. it shows the year 2008 as2008
)yy
- shows the year with two numbers (e.g. it shows the year 2008 as08
)mm
- shows the month with two numbers (e.g. it shows June as06
)m
- shows the month with a simple number (e.g. it shows June as6
)M
- shows the word for the month in the selected language (e.g. if the month is June, it showsJune
in English andjunio
in Spanish)dd
- shows the day of the month with two numbers (e.g. the first day of the month is01
)d
- shows the day of the month with a simple number (e.g. the first day of the month is1
)h
- shows the hour with two numbers in a 24 hour clock (e.g. 2pm is14
)i
- shows the minutes with two numbers (e.g. first minute is01
)s
- shows the seconds with two numbers (e.g. first second is01
)
- string language: The language used to reformat the date. It can be
'en'
(English),'es'
(Spanish) or'fa'
(Persian). If not included, English is set as the default language.
Return value:
- string: Returns the date passed in the given date format.
Note: For other languages, use PHP's strftime() function. See Formatting Dates in Other Locales.
Examples:
The value of @@textBox will be 'June 11, 2008'
:
The value of @@textBox will be '7 de Junio del 2008'
:
The value of @@textBox will be '07/06/08 06:45:04'
:
(In this example, the language parameter is omitted and English is used by default)
getCurrentDate()
getCurrentDate()
retrieves the current date in the format "yyyy-mm-dd", with leading zeros in the month and day if less than 10. This function is equivalent to PHP's date("Y-m-d")
.
Parameters:
- This function does not need any parameter.
Return value:
- string: Returns the current date as a string value.
Example:
If the current date is December 16, 2009:
The value of @@mytextBox
will be '2009-12-16'
.
getCurrentTime()
getCurrentTime()
returns a string with the current time in the format "hh:mm:ss" with leading zeros when the hours, minutes or seconds are less than 10. The hour is expressed in the 24 hour format (military time) and is a number between 00 and 23. This function is equivalent to PHP's date('H:i:s')
.
Parameters:
- This function does not need any parameters.
Return value:
- string: The function returns the current time as a string.
Example:
If the current time is 9:13 am, then:
The value of the @@curTime
will be '09:13:23'
.
literalDate()
literalDate()
returns a specified date written out in a given language, (e.g, English: "2008-06-11"
returns "June 11, 2008"
, Spanish: "2008-06-11"
returns "11 de Junio de 2008"
).
Parameters:
- string date: The input date as a a string in standard
YYYY-MM-DD
format. - string language: The displayed language, which can be 'en' (English) or 'es' (Spanish). If not included, then it will be English by default.
Return value:
The literal date is returned as a string.
Note: For other languages, use PHP's strftime() function. See Formatting Dates in Other Locales.
Example:
The returned value stored in @@textBox
will be 'December 17, 2009'
.