How can I get diff in seconds between two string datetime fields on server script. After this I want to use the method frappe.utils.format_duration() to get this different in a pretty way.
1 Like
first_date=frappe.utils.get_datetime("2023-01-01")
second_date=frappe.utils.get_datetime("2023-01-24")
diff=frappe.utils.time_diff_in_seconds(second_date,first_date)
pretty=frappe.utils.format_duration(diff)
3 Likes
A lot of thanks @bahaou. Works perfectly, just what I was looking for ![]()
@heavyweb set answer as solution please
Sorry @bahaou I was searching how to do that and didn’t find it. Do you know how to do it?