timer with a startat datetime variable in a different time zone
1 回表示 (過去 30 日間)
古いコメントを表示
I would like to schedule a task described in 'dummy_script' at e.g. 8:00 am New York time. I do not live in the US but for convenience (daylight saving changes,...) I would like to use New York time as my reference point for my 'startat' time (trigger1) to make sure it always trigger at 8:00 am NY time.
trigger1 = datetime(2020,10,8,8,00,0,'TimeZone','America/New_York')
This is my simple timer function:
t = timer;
t.TimerFcn = @(~,~) dummy_script1;
startat(t,trigger2)
The only way I can make this work is by defining trigger1 as specified above and then converting it to my local time zone before I use it as a reference point:
trigger2.TimeZone = 'local'
Is there a more elegant way of having Matlab recognise and consider the time zone set for trigger1?
0 件のコメント
回答 (1 件)
Seth Furman
2020 年 10 月 28 日
Thank you for reporting this issue. Unfortunately, the startat function currently ignores timezone information when a zoned datetime is provided. I've logged this issue and it may be addressed in a future release. In the meantime, datetime values not in the local timezone will have to be converted to the local timezone before calling startat.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Recognition, Object Detection, and Semantic Segmentation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!