Expression question

I am curious, In an Expression, What are the differences between -

and -
dateFormat(now(),"HH:mm:ss")

In the context of that thread, nothing. but there really is a difference.

now() uses the host computers clock. So if you use it in a component or client tag, the client’s clock is used. In ‘regular’ tags, the gateway’s clock is used.

{[System]Client/System/CurrentDateTime}, as the name implies, always points to the client’s clock.

1 Like

There’s also a theoretical (almost nonexistent) difference in latency, because now() will directly call out and create a new Java Date instance, where the tag read has to dispatch through a few more layers. In practice, I doubt it would make even a few milliseconds difference.

2 Likes