Script get current date and time

Hi Guys!
Any chance of getting current time in a script?
In need of (example) 2022-02-09_14

Thanks!

var
  Time: string;
  
begin
  Time := FormatDateTime('yyyy-mm-dd_hh', FakeNow);
  SystemLog('The time is: ' + Time);
end.

1 Like

Hi!
Thanks.

If i were to add one hour to the current hour… Is that possible?

Just add 0.0417 (= 1/24):

Time := FormatDateTime('yyyy-mm-dd_hh', FakeNow + 0.0417);

Unfortuntately, there is some bug in the script engine that prevents you from writing + 1/24 (it will round that down to 0).

1 Like

Note that FakeNow represents the current time in the mAirList universe, which may differ from the system time. If you prefer the latter, use Now rather.

1 Like

Well, it is the system time - unless you happen to double-click the clock in the bottom right corner of the status bar and set it to something else :wink:

Bildschirmfoto von Parallels Desktop (09-02-22, 16-10-21)

1 Like