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!