How to add a read-only timestamp to doctype? (to display current time)

How do access current date/time in read-only field? (display only)

How do access submitted time?

Figured it out…

If fieldtype is datetime

  1. read-only = true
  2. default = Now

If fieldtype is date

  1. read-only = true
  2. default = Today

Now sure about field type “time”, but I would assume default to get current time is “Now” like datetime.

1 Like

Glad you found a solution! Just FYI, the read only property affects only the html form. Somebody who knows how frappe works would still be able to edit the timestamp directly using javascript. If you want to more securely restrict write access, you can use field permission levels, which is only slightly more complicated.

1 Like

Hello,

Could you please advise if we can record the date & time as timestamp number format not as date and time (like 1636454354 instead of 9-11-2021 10:39:14)

Thank you