This topic describes the syntax and usage of the toString function in Zoho Creator .


The toString function converts any type of expression to string. 





//this format is supported only in the free-flow scripting mode of script builder.

The toString function syntax has the following arguments:

expression -  Required. The expression to be converted to a string.



(12345).toString();             //returns "12345"

SaleDate.toString();     //returns string format of date field called "SaleDate"

toString(12345);             //returns "12345"

toString(SaleDate);              //returns string format of date field called "SaleDate"

Note: Behavior of toString()when applied to datetime value:

  • toString(<date/datetime>) function on date/datetime will output date string in the format specified in the application setting.
  • If you want to override it, you can use <date/datetime>.toString("date format as string"). eg. toString("dd-MM-yyyy")
  • If you wish convert to string in different timezone, you can use <date/datetime>.toString("date format as string","<Time Zoho>"). eg. toString("dd-MM-yyyy","Asia/Calcutta")
  • The Date and Time pattern strings are mentioned below,
    • Date - dd
    • Month - MM (or) MMM (or) MMMM
    • Year - yy (or) yyyy
    • 12 hour format - hh
    • 24 hour format - HH
    • minute - mm
    • second - ss
    • AM/PM marker - a

To get the time portion from a date-time string use the toString() function, as shown in the below code:

a = ’01-Oct-2010 10:11:12′ ;
alert a.toString(“HH:mm:ss”);

This returns the Time portion string from date-time value.