Suggestion: Add token for milliseconds to time codes

The Date object and the Format method already support milliseconds. It'd be nice if the time codes did as well. Using the ms property in a script is a bit clunky and everywhere else milliseconds are not available at all (or are they?).

In the next update, you can prefix the time format with M to include milliseconds in the seconds part.

(It acts like the "show milliseconds" Preferences setting, rather than a new code you can add anywhere you want. Syntax is similar to the existing I prefix for using the system invariant locale.)

For example, {time|MHH:mm:ss} might output 20:55:49.028

1 Like

Currently a Date object can be modified by adding or subtracting milliseconds but I don't believe there is a way to apply a millisecond level change to a file's date using SetAttr.

According to SetAttr help:

The accepted formats for the date string are YYYYMMDD or YYYY-MM-DD, and the time string must be in the format HH:MM:SS.

Thus a command like SetAttr FILE "C:\Test\Sample.txt" MODIFIED "20211011 12:13:14" will always set milliseconds to zero.

What are you doing where you need to set timestamps to millisecond accuracy?

Nothing of any consequence. :blush: I created a button to duplicate a selected file or files and add a prefix or suffix timestamp. I habitually sort by date descending and whether prefixed or suffixed I wanted the copy to sort after the original so I used SetAttr to subtract time. My first hack subtracted a second and then I thought why subtract a second when a millisecond would do? :sunglasses: As I said, nothing of consequence.

1 Like