I want to know whether or not it is Daylight Saving time
I want to know whether or not it is Daylight Saving time
14 Apr 2017, 04:52
Hi.
I understand that we must make cBots by UTC timezone.
But I want to change the operation time of my cBots by Daylight Saving time or not.
How can I do it?
Replies
mparama
01 May 2020, 03:26
RE:
driftingprogrammer said:
Hi,
I am facing the same problem in my Indicator.
Half the year the server runs on UTC+2 time zone and half the year it runs on UTC+3 time zone. The transition happens randomly during a certain weekend.
When my Indicator is invoked for MarketSeries.OpenTime.LastSeries being 0030hr on 4th november, i want to know if it is in UTC+2 timezone or UTC+3 timezone, or in other words i want to know if the daylight saving is on or off because only then i can know if the data is applicable to 3rd November or 4the November.
Any help is appreciated.
Thanks in advance,
Warm Regards,
Vipin.
Try this:
if (Server.TimeInUtc.IsDaylightSavingTime())
{
currentHours = Server.TimeInUtc.AddHours(+3).TimeOfDay.Hours;
currentMinute = Server.TimeInUtc.TimeOfDay.Minutes;
}
if (!Server.TimeInUtc.IsDaylightSavingTime())
{
currentHours = Server.TimeInUtc.AddHours(+2).TimeOfDay.Hours;
currentMinute = Server.TimeInUtc.TimeOfDay.Minutes;
}
@mparama
driftingprogrammer
21 Dec 2019, 13:16
Hi,
I am facing the same problem in my Indicator.
Half the year the server runs on UTC+2 time zone and half the year it runs on UTC+3 time zone. The transition happens randomly during a certain weekend.
When my Indicator is invoked for MarketSeries.OpenTime.LastSeries being 0030hr on 4th november, i want to know if it is in UTC+2 timezone or UTC+3 timezone, or in other words i want to know if the daylight saving is on or off because only then i can know if the data is applicable to 3rd November or 4the November.
Any help is appreciated.
Thanks in advance,
Warm Regards,
Vipin.
@driftingprogrammer