Custom script for required changes


I want to make custom script to count difference between two input times, and difference between two times displays in total time field. So, to achieve this outcome, how can i start scripting and in which file i have to make changes.

I am using local server in development mode.

An example will be more helpful. :slight_smile:

Hardik Gadesha

Please try this.

import frappe.utils,time2)

Thanks, Sukrut
New Indictranstech

Thanks @jsukrut for your inputs.

Look my idea is actually like as shown in below figure.

Here i created a custom DocType and put 3 custom DocFields inside it as a 1) Start Time 2) End Time 3) Total Time. For start time and stop time, i put a time picker. Now i want total time difference between those two selected time. So as i am new to coding stuff, how can i calculate time difference and display it to total time field automatically ?

Thanks & Regards,
Hardik Gadesha
Software Engineer @ AIMDek Technologies Pvt Ltd

@Hardik_Gadesha Do you want difference between start time and end time?

Yes @jsukrut. In HH:MM formate. :slight_smile:


import frappe.utils

def validate(self):,self.starttime,)

Thanks, Sukrut
New Indictranstech

Thanks @jsukrut for your efforts.

Let me try first. Where i have to write this code ?

Hardik Gadesha

In controller
eg. ( Suppose Meeting is your doctype name)

Okay @jsukrut .

I am running Frappe bench on localhost in development mode not in production mode. So, i have to write JavaScript for time difference calculation, Right ? :question:

Watch frappe developer Training videos .It contain only 10 videos. use below link.


Thanks @jsukrut For your kind reply. :slight_smile: