Referencing the current month

Hello!

I have an application that constantly has to use the first second of the current month and I have a feeling that i’m doing it in a very unsophisticated way:
Every month I manually overwrite a device tag containing a source date, in the standard format, ready to be used in a date/time node.

image

  • Is it possible to update a tag periodically and automatically? I know that you can do it manually through the input controls block, but that is not what I need;
  • Is there a way to reference a specific time of the current month? For example, triggering a workflow every 11PM of the last day of the current month.

Any insight would be greatly appreciated.

The answer to both of your questions is the Timer Trigger’s Advanced mode, where you can provide a cron string to fire the workflow on a very specific schedule.

There are several cron string generator websites out there that can help you build the configuration for the trigger.

I am curious about your use case, though, and your storing of this information on a device tag. It’s a static value that is easy to calculate at runtime; if you can tell me a little more about why you are storing this value on your device metadata, I might be able to offer a simpler alternative.

Hey, Dylan. I suspected the advanced timer would help me, thanks for the answer.

About this section of my application: I have to show, with precision, some data starting at 00:00:01 of the first day of the month until now.

In summary, here’s what this part of my workflow does:

  • A Date/time node converts the present time to miliseconds;
  • Another Date/time node converts the Device Tag time (2023, march 1st, 00:00:01) to miliseconds;
  • A Math node calculates this difference;
  • Data: Gauge Query node uses this difference as the Range Duration and the current time as the Range End. Using Aggregation:Sum, I have the number I want, from the beginning of march until the last value.

It’s easy, but, as I mentioned, it feels kinda brute/inefficient.