Date Time in Android & WCF API

I was working on Android APP related to custom CRM. Where I was to save appointment in database using WCF API. I tried couple of solutions. I tried sending date without time zone offset the WCF API saved 1 hour before timing.  I tried with correct offset of time zone but still facing issue then I tried with and send date time as string without time zone and it worked.



SimpleDateFormat format1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

Add hrs and min to date time in Android Java;



public static Date addMinutesToDate(Date date, int minutes) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MINUTE, minutes);
        return calendar.getTime();

public static Date addHoursToDate(Date date, int hours) {
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.HOUR_OF_DAY, hours);
    return calendar.getTime();

CSV String in API Response

I was working on a project  and was using REST API to import records from third party application to Zoho CRM. The API returns the data in CSV formatted string.  I used PHP and used the following logic to create records in CRM.


$csvData = file_get_contents($fileName); // It was actually API call.
$lines = explode(PHP_EOL, $csvData);
$array = array();
foreach ($lines as $line) {
    $array[] = str_getcsv($line);

Handle API Date In Deluge

I was working on API in Zoho CRM and used deluge script. There I faced problem to handle datetime field to create a record. Zoho use specific format to handle date. It is then solved using the following function.

newdate = zoho.currenttime.addMinutes(30).toString("yyyy-MM-dd'T'HH:mm:ss'+05:30'");


In PHP, i faced the similar problem when using PHP Zoho CRM SDK V2.  I then also solved it using the following datatime function.

$dt = new DateTime();

$start_timestamp = $dt->format('c');



Delete Log files after 10 days

I was creating web hook for an application and needed to write a log , so i created this function as to delete a log file after 10 days as log file size increase with passage of time.

function deleteLogFileAfter10Days()
$fileSystemIterator = new FilesystemIterator(‘logs’);
$now = time();
foreach ($fileSystemIterator as $file) {
if ($now – $file->getCTime() >= 60 * 60 * 24 * 10) // 2 days

Send attachment in email deluge script

Send attachment in Email using deluge script Zoho CRM

CRMresponse = zoho.crm.getRelatedRecords(“Attachments”,”Deals”,id.toLong());
opp_info = zoho.crm.getRecordById(“Deals”,id.toLong());
contact_id = ifnull(opp_info.get(“Contact_Name”).get(“id”),””);
contact_info = zoho.crm.getRecordById(“Contacts”,contact_id);
email = ifnull(contact_info.get(“Email”),””);
info email;
if(email != “”)
for each record in CRMresponse
file_id = record.get(“id”);
downloadFile = invokeurl
url :”” + id + “/Attachments/” + file_id
type :GET
from :zoho.adminuserid
to :email
subject :”Test subject”
message :”<h2>Test Email</h2>”
content type :HTML
Attachments :file:downloadFile

Think different!!!