Datetime field not working properly in print

Dear Community,
I Created two fields name as Start time and End Time ,Field Name: started, Fieldtype as Datetime ,Here am using code of {{ frappe.utils.format_date(doc.started) }} {{ frappe.utils.format_time(doc.started) }} to get my date in order as “DD-MM-YYYY”,but this code only corrects date and time shows incorrect also even i try without this code like {{doc.started}} still time not showing correctly.

Above date time is given as 04-01-2024 01:30:15 but it shows as 04-10-2024 11:39:45

also tried different code as
{{‘%d-%m-%Y %H:%M:%S’) }}
{{ frappe.utils.format_datetime(doc.started, “dd-MM-yyyy HH:mm:ss”) }}

but it not works, kindly help to solve this issue.
Thanks in Advance.

Hi @Mohamed2335,

Please try it.

{{ doc.get_formatted('started') }}

Thank You!

sir thanks for your response but still time take static

Do you want the current time?

no given time in field

Can you share the screenshot? and actually, what do you want?

if you use {{ doc.get_formatted(‘started’) }} then it will show proper data according to the format.


{{ frappe.utils.format_date(doc.started) }} {{ frappe.utils.format_time(doc.started) }}
this code works for me