A very quick article to show pushing the date and time to ZohoCRM or ZohoCreator.
Why?
You may have received an error that goes something like:
datatype: datetime
How?
Here are some formatting examples:
Creator to CRM:
v_CreatorTime = zoho.currenttime.toTime(); v_CrmTime = v_CreatorTime.toString("yyyy-MM-dd'T'HH:mm:ss") + v_CreatorTime.toString("Z").subString(0,3) + ":" + v_CreatorTime.toString("Z").subString(3); info v_CrmTime; // yields 2021-09-10T12:49:31-07:00
- v_CreatorTime = zoho.currenttime.toTime();
- v_CrmTime = v_CreatorTime.toString("yyyy-MM-dd'T'HH:mm:ss") + v_CreatorTime.toString("Z").subString(0,3) + ":" + v_CreatorTime.toString("Z").subString(3);
- info v_CrmTime;
- // yields 2021-09-10T12:49:31-07:00
Depends on the format of the datetime in your Creator field but standard would be:
v_CrmTime = "2021-01-01T01:23:45+01:00"; v_CreatorTime = v_CrmTime.getPrefix("T") + " " + v_CrmTime.getPrefix("+").getSuffix("T"); info v_CreatorTime.toTime(); // yields 01-Jan-2021 01:23:45
- v_CrmTime = "2021-01-01T01:23:45+01:00";
- v_CreatorTime = v_CrmTime.getPrefix("T") + " " + v_CrmTime.getPrefix("+").getSuffix("T");
- info v_CreatorTime.toTime();
- // yields 01-Jan-2021 01:23:45