Convert ICUDateTime to Unixtime

Correct, you cannot put text tokens in a numeric field, so in a numeric field, you cannot do TIME(%Local_DateTime%). Similarly, in a text field, which you can use the %Calculate%numeric field% token, but within the numeric field part, you are effectively in a numeric field and so cannot use text tokens.

You can do this:

image

Note that the second action, being a text field, processes the %DateTime% token (I removed the Local so that the values show in the action). so that the Time variable is set to TIME(2020,08,10,12,00,00). And then you can use the Filter action to calculate the value stored in there.

Note that in a numeric calculation, when you reference a variable, Keyboard Maestro will actually evaluate it to determine it's value, so if it contains TIME(2020,08,10,12,00,00) you can freely use that in a numeric field contact, for example:

image

Note that the fields in each of these actions is a text field, not a numeric field, so each one is processing text tokens. Only the part in the middle of the last action (Time - GMTOFFSET()) is a numeric field. Keyboard Maestro retrieves the numeric value from the Time variable by evaluating TIME(2020,08,10,12,00,00).

1 Like