I need to format date and time in Print Formats. I use frappe.utils.now() but I got something like 2016-04-04 15:47:33.217346 wich is not what I want.
How can I format date and time depending on user’s locale?
@emakis use doc.get_formatted('fieldname')
Hi @Maxwell_Morais,
I don’t need a ‘fieldname’ I just need the current date and current time, at the moment the user prints the doctype… I also tried doc.formatted(frappe.utils.now()) but didn’t work.
Any other suggestion?
If you want current date and current time using frappe.utils.now()
you have to split Date and Time using jinja template. Try below script
{% set date = frappe.utils.now().split(' ')[0] %}
{% set time = frappe.utils.now().split(' ')[1] %}
Date = {{ date }} <br />
Time = {{ time }}
@emakis, is a bit more complex, by the way is:
{{ frappe.format_value(frappe.utils.now(), {'fieldtype': 'Date'}) }}