Date only showing in milliseconds

Hello, In all of my macros, the time is currently displaying in milliseconds. I'm not sure why its doing it and haven't been able to find a fix. Does anyone know what might cause it?

Thanks!

You would need to show us an example of:

  1. an actual macro, and
  2. what you had expected.

before we can form any impression of what you are describing, and how it could be changed.

See:

and:
Dates and Times [Keyboard Maestro Wiki]

1 Like

Thanks for your reply! The screenshot shows the input request at the beginning of the macro. I want the date to show as yyyy/mm/dd, but instead have the long string of numbers.

Thanks

A date-time value formed by one of the Keyboard Maestro Calculation functions is a string representation of a number of milliseconds since the unix epoch (dot of midnight at the UTC start of 1970)

See: Date/Time Functions and Calculations
which is a section in the lower part of this page:

Dates and Times [Keyboard Maestro Wiki]

You can display these values as formatted calendar strings (rather than integer strings) by sandwiching their names inside this kind of structure:

%ICUDateTimeFor% ... %EEE, MMM d, yyyy%

with:

  • %ICUDateTimeFor% to their left, and
  • a specification of your preferred calendar string pattern to their right.

So for example:

which might return a display like:

Thanks for your help. I think I must be missing something. I've set it up as you have (I think?), but it's still giving in milliseconds. Just to clarify, the date I'm wanting to show as ICU is coming from a user input box.

Thanks again!

  • Tell me more about what the expression it's still giving in means to you ?
  • what is the relationship between the 16/07/2022 (year last) displayed above, and the yy/MM/dd string shown below ? (year first ?)
  • How are you going to use the captured date ? Just as a string to include in a document, or will you apply any further calculations to it ?

If you need to obtain the results of any calculations involving the date, you will need to capture the millisecond version which calculation functions can use. (You can still display the millisecond version as a calendar string)

If you just need a human-legible string, then you should be able to do something like this:

Prompt for date value.kmmacros (3.4 KB)

and more flexibly:

  • retaining the millisecond version (with the data type for that prompt field set to date) (in case further calculations are needed)
  • but displaying it as a calendar string.

Prompt for date value II.kmmacros (3.9 KB)

That works! Thank you so much for your help and patience. I'm on a steep (but really interesting) learning curve.

1 Like