toText
Table of Contents
Note: This task is applicable to all services except Zoho Creator
Overview
The toText function takes an expression, and returns it as text.
Note:
- If the expression is of type date-time or number (milliseconds), you can specify two optional arguments, dateTimeFormat and timeZone, additionally.
 - The function will return the timestamp expression in the specified dateTimeFormat, converted into the specified timeZone.
 - If the function fails to recognise the date-time value, it will simply return the given value in text format.
 
Return Type
- TEXT
 
Syntax
<variable> = <expression>.toText(<dateTimeFormat>, <timeZone>);
(OR)
<variable> = toText(<expression>, <dateTimeFormat>, <timeZone>);
(OR)
<variable> = <expression>.toString(<dateTimeFormat>, <timeZone>);
(OR)
<variable> = toString(<expression>, <dateTimeFormat>, <timeZone>);
where,
| Parameter | Data type | Description | 
| <variable> | TEXT | Variable which will contain the returned value. | 
| <expression> | ALL DATA TYPES | The expression which will be returned in text format. | 
<dateTimeFormat> (optional)  | TEXT | The format in which the date time value will be returned. Note: 
  | 
<timeZone> (optional)  | TEXT | Time zone in which the date-time value will be returned. Note: 
  | 
Applicable Date-Time Literals
| Letter | Date and Time Component | 
| G | Era designator | 
| y | Calendar year Examples: y - 2019 yy -19 yyy - 2019 dateValue = '29-Dec-2019';  | 
| Y | Week year Examples: Y - 2019 YY -19 YYY - 2019 dateValue = '29-Dec-2019';  | 
| M | Month in year Examples: M - 1 MM - 01 MMM - Jan  | 
| w | Week in year | 
| W | Week in month | 
| D | Day in year | 
| d | Day in month | 
| F | Day of week in month | 
| E | Day name in week Examples: E - Tue EEEE - Tuesday  | 
| u | Day number of week | 
| a | am/pm marker | 
| H | Hour in day (0-23) | 
| k | Hour in day (1-24) | 
| K | Hour in am/pm (0-11) | 
| h | Hour in am/pm (1-12) | 
| m | Minute in hour | 
| s | Second in minute | 
| S | Millisecond | 
| z | General time zone | 
| Z | RFC time zone | 
| X | ISO 8601 time zone | 
Examples
marks = 100; info toText(marks); // returns "100"
marks = 100; info toText(marks); // returns "100"
dateValue = '01-Jan-2019 10:15:30'; info toText(dateValue, "MMM dd, yy 'at' hh:mm:ss, E", "Europe/Moscow"); // returns "Jan 01, 19 at 07:45:30, Fri"
milliValue = 1596719471334; info toText(milliValue, "MMM dd, yy 'at' hh:mm:ss, E", "Europe/Moscow"); // Returns "Aug 06, 20 at 03:41:11, Thu"