Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 04:31:21 +0000



[Programming Help] - Question about function sc.ConvertDateTimeFromChartTimeZone()

View Count: 203

[2023-03-13 16:26:11]
Tony - Posts: 458
Hi,

For Los Angeles local time, both these lines work fine:

sc.ConvertDateTimeFromChartTimeZone(sc.CurrentSystemDateTime, TIMEZONE_LOS_ANGELES);
sc.ConvertDateTimeFromChartTimeZone(sc.CurrentSystemDateTime, "PST-08PDT+01,M3.2.0/02:00,M11.1.0/02:00");

I prefer TimeZonesEnum over TimeZonePOSIXString, because it is easier to read, but I am
not able to figure out how to assign values to a TimeZonesEnum variable. I tried:

TimeZonesEnum MyLocalTime;
MyLocalTime = TIMEZONE_LOS_ANGELES;
sc.ConvertDateTimeFromChartTimeZone(sc.CurrentSystemDateTime, MyLocalTime);

It didn't work, not sure what I missed, wonder if someone could help, thanks so much!!

Also, I would like to confirm, if I set TimeZonePOSIXString empty "", does that mean
sc.ConvertDateTimeFromChartTimeZone will have no effect (set time zone same as time chart zone) ?
Date Time Of Last Edit: 2023-03-13 17:04:14
[2023-03-13 17:02:13]
User907968 - Posts: 802

auto tZ = TimeZonesEnum::TIMEZONE_LOS_ANGELES;
auto nDt = sc.ConvertDateTimeFromChartTimeZone(sc.CurrentSystemDateTime, tZ);

Works fine for me
[2023-03-13 17:13:15]
Tony - Posts: 458
Thanks so much User907968! Everything works great now!

I didn't know the keyword "auto", I am glad learned something new today!

Thanks again!

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account