Default time value in erpnext time field

I set the time field in a doctype and in its default section set it to ‘Now’, it gives me time with date but I only need time how can I do this?

1 Like

If going through doctype level, set the type of field to Time and then try. I guess Now and Today both will work

But will will give you timestamp also. If want to set it as HH:mm:ss i doubt it can be possible at that level. But if requiring so, opt for custom script something like

moment(frappe.datetime.now_datetime()).format("HH:mm:ss")

Hope this will help

1 Like

I had set type field to time still got along with date, I will then try with custom script

I just tried and got only time there. Clear cache (ctrl+shift+r) and retry

If still getting problem, show a snap for field type and its attributes you had set

Getting date here

I actually tried that on a field and it worked

I’ll suggest check again via doctype and customize form whether its datetime or time type because I doubt its still datetime

I am still getting it with date, did you add any additional changes? Like I added this filed like mentioned and when I create a new record it always show me with date

So I figured it out that it works fine with quick entry only.

you can set time through custom script too.

like this cur_frm.set_value('field_name', frappe.datetime.now_time()); put it in refresh function so you can get current time