Automatically List Current Date and Track Time?

Hey Everyone,

I’m new to Markdown and Obsidian! I’m trying to make the switch from notetaking thru Scrivener and have been watching videos and lurking on the forums here for a couple of weeks as I try to get the hang of everything.

I am working on a MAC OS and wanted to know if there was (especially when using the Daily Notes plugin) a way to include in a template the current date and also the time information was entered.

For example if I were to create a new note today would it be possible to list at the top, in the note:
6/11/2020 2:17PM

and then have that time change based on when it was last edited?

Thanks so much and I apologise if this is the wrong board to post, I’m still doing my best to learn everything I can here.

6 Likes

I would love this feature as well, though in my case I’d love an option so that the date / time stamp doesn’t auto-update when the file is modified. A creation datetime rather than a last modified datetime.

Both please! The template I’ve been using for new notes puts both a creation date and a last modified date (same as the creation date) at the top of the note, and I try to make a habit of updating the modified date whenever I edit the note; having it automatically update would be great

1 Like

I do this with a text expander.
And a different shortcut gives me an h6 followed by this in a zettelkasten format. Makes it very easy to create linkable blocks with a UID.

Of course if the modification is an edit rather than a new entry, it doesn’t work very well for your purpose.

This looks older, but does anyone have a method of automatically placing text for “Last updated: YYYY-MM-DD” in a note somewhere based on when it was last updated?

3 Likes

@mkudija
Steps

  1. Install dataview plugin
  2. Enable dataview plugin
  3. Type the following on the note you want to view the last modified date
    ```dataview
    table file.mday
    where file.name = "The note name"
    ```
    And that is it. So the next time you modify the note it will automatically update the date and you can view it on preview.
3 Likes

This thread is very old, but in case anyone still wants to know how to do this:

I have 2 ways of doing this without relying on community plugins:

A) More static via template:

Steps:

  1. Create template with following content:
Modified: {{date:YYMMDD}} {{time:HH:mm}}
  1. Use “Insert template” to insert the current datetime in note

B) Totaly dynamic, reading the filesystem’s datetimes:

Use:

FS Created: `$= dv.el('span', dv.current().file.ctime.toLocaleString(DateTime.DATETIME_MED_WITH_SECONDS))`
FS Modified: `$= dv.el('span', dv.current().file.mtime.toLocaleString(DateTime.DATETIME_MED_WITH_SECONDS))`

This can be pasted into the note directly or via template.

Obviously, you can use your preferred date format.
I’m partial to YYMMDD, because it seems most logical and can be comfortably used to sort and compare.

The first method I use to insert creation date in all my notes, because Obsidian uses the filesystem’s created date, which is wildly unreliable, because it reflects when the file has been created on this particular file system and this changes in all kinds of manner through syncs or just copying the vault to new directory and/or device.

Hope this still helps somebody
Cheers