Page 1 of 1

Check UTC on certain day

Posted: Fri Oct 16, 2026 8:44 am
by Rukbunker
Hey Oleg,

Timezone Amsterdam here.

I have a task where files are being generated with timestamps in the content, including UTC, see here:
<Schedule serviceIDRef="RFLE" start="2026-10-11T06:00:00+02:00" end="2026-10-12T06:00:00+02:00">
However, these files are generated 30 days up front. So, in the meantime, UTC can be +1 instead of +2 despite on the day of generation it's still +2 (summer).

I need some kind of script which checks for yyyy-mm-dd if UTC+1 or UTC+2 is applicable for that date. I have it working now in Powershell, but I'm just woundering if Robotask has some kind of native solution because I notice that this powershell script is delaying the task quite and the task should run as fast as possible. As said: it works now, it's just curiousity.

Code: Select all

# Vaste datum instellen
$datum = [datetime]"{DateTimeToFormat({DateIncDays({PERIOD_START})},yyyy-mm-dd)}"

# Tijdzone Amsterdam
$tijdzone = [System.TimeZoneInfo]::FindSystemTimeZoneById("W. Europe Standard Time")

# Bepaal de tijdzone op basis van de opgegeven datum
$zomertijd = $tijdzone.IsDaylightSavingTime($datum)

if ($zomertijd) {
    Write-Output "02:00"
}
else {
    Write-Output "01:00"
}

Re: Check UTC on certain day

Posted: Fri Oct 16, 2026 9:40 am
by Oleg
Do you want to calculate the time offset for any date? Am I understanding this correctly?
Look at my example below.
set any date in step #1 and get the time offset for this date.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1133661666
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task105"
Hide=INTEGER|0
ID=INTEGER|1627632359
LogOnAsUser=INTEGER|1
Name=STRING|"GMT offset for any date"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_dt"" with value ""{FormatToDateTime(2026-11-16,yyyy-mm-dd)}"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"_dt"
expand=STRING|"1"
linecount=STRING|"1"
varname=STRING|"_dt"
varvalue=STRING|"{FormatToDateTime(2026-11-16,yyyy-mm-dd)}"

[Actions\Action2]
ActionID=STRING|"A_TIMEDIFFERENCE"
Enabled=INTEGER|-1
Name=STRING|"Time Difference"
Params=FOLDER

[Actions\Action2\Params]
_rt_variables_produced=STRING|"_diff"
datetime1=STRING|"{GMTDateTime({_dt})}"
datetime2=STRING|"{_dt}"
format=STRING|"2"
valuekind=STRING|"0"
varname=STRING|"_diff"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Local time: {_dt}"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"Local time: {_dt}"
msg1=STRING|"GMT time: {GMTDateTime({_dt})}"
msg2=STRING|"offset: {_diff} hours"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"


Re: Check UTC on certain day

Posted: Fri Oct 16, 2026 9:11 pm
by Rukbunker
Ofcourse! So simple! Why am I thinking so difficult......

Thanks, Oleg!