What's the best format in yaml for duration, for later reporting in dataview


As a beginner, I’m experimenting with some notes that I can generate from youtube videos for later updating with notes, and then reporting with dataview. One of the fields I want to use is video duration in hours, minutes and seconds.

What’s the next format for a duration field in YAML?

As far as I can tell, the best option would be a string representation of duration that would be easy to convert to an object, but what do I know?

What’s the best way to report it in dataview?

Existing notes are just strings in the format h:mm:ss or hh:mm:ss or mm:ss or just ss which I can’t really work with in terms of “give me the short videos in the range of 1-2 hours long” etc.

Or does this all require dataviewjs?


See the documentation of Dataview, as it explains all the various options. Short version, and full version.

In short it’s quite acceptable related to entering a duration as a text field. :slight_smile:

Thanks! So something like this in YAML would be ok (other similar literals are available), and then with dur(duration) other expressions could be formed to select notes:

duration: 4h 3m 22s

TABLE duration
WHERE dur(duration) >= dur(1h 0m 0s) and dur(duration) <= dur(2h 0m 0s)

although the dur seems to work above, it can be take away
WHERE duration >= dur(1h 0m 0s) and duration < dur(2h 0m 0s)

If I have a YAML that looks like this:

duration: 04:03:22

then I could theoretically take parts of the string with an expression and end up with 4h 3m 22s

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.