How to Check if a File Is Older Than Yesterday?

how to check if file is older than yesterday?

i am getting the modification date of the file - in unix time

and then trying to set to icudatetime - but i get error

Hi @JoshuaPaul,

It's because you use "Set Variable To Calculation". Try "Set Variable To Text":

1 Like

Hey Joshua,

Did you run the macro?

The syntax looks okay, but if FMSBackupsSync hasn't been initialized then the date/time token has nothing to work with.

You can't do date math with that token anyway.

Here's something to get you started.

Note – you have to decide what Yesterday means to you – currently I have it set for midnight Today.


Get the Modification Date of a Single Selected Item in the Finder v1.00.kmmacros (9.1 KB)
Keyboard Maestro Export

1 Like

Oh, yeah – these might be of interest:

Dates and Times [Keyboard Maestro Wiki]

KM Dates & Times: Notes on Anchors, Intervals, and Translations

Good eye!  :sunglasses:


thanks for feedback

i am now using set variable to text - and i am not getting dates

hope you can help

this worked! thanks!!!!

This may no longer be relevant if ccstone's solution is working for you, but I expect you're not getting a date because you aren't using the same variable in the token:

1 Like

Good deal!

BTW – don't do this:


Always use the full variable format for variable expansion like so:


Otherwise you can't tell by looking what is a variable and what is a KM text-token.