Is there a way to calculate how much time is left from current time to a specific time? Like if I have time string "09:00" and current time is 20:40, how to calculate difference between those times?
That's my code for New York time:
TimeToStr(TimeLocal() + ((- 4 - Timezone + dstDelta) * 3600), TIME_SECONDS)
There is 11:43 now and if I have specific time like 09:00 how to calculate how much time left till 09:00?
Seconds left = specific time - current time. Convert your string to time. If the converted time is in the past, add 24 hours.
string Time1 = "09:00:00";
string Time2 = TimeToStr(TimeLocal(), TIME_SECONDS);
WriteText (del + "SydnayOpens", Time1 - Time2, "Arial", White, 205, 125, "\n", 9, 2, ANCHOR_LEFT_LOWER, FALSE);
'-' - illegal operation use
Convert your strings to time.
You can not subtract string values.
When I'm converting string to time and subtracting I'm getting some numbers like (-52447) and when I'm converting this numbers back to string with TimeToString() it's not giving me anything
What part of "If the converted time is in the past, add 24 hours," is unclear to you.
What part of “Seconds left =” is unclear to you. You can't convert seconds left to a datetime and then to a string.
datetime SYsT = StrToTime("09:00:00") - (TimeLocal() + (( 11 - Timezone) * 3600));
I finally did it ...
Please enable the necessary setting in your browser, otherwise you will not be able to log in.