When loading the calendar, I have divided the hours into intervals of 30 mins each.
This is my initial configuration.
scheduler.locale.labels.unit_tab = "Resources";
scheduler.config.hour_date = "%h:%i %A";
scheduler.config.hour_size_px = 88;
scheduler.config.mark_now = true;
scheduler.locale.labels.section_custom = "Assigned to";
scheduler.config.separate_short_events = true;
scheduler.config.drag_move = false;
scheduler.config.drag_resize = false;
Due to the 30 mins, my calendar has a scroll bar. The default calendar shows only about 6.5 hrs. So if the current time is 3 PM, the mark_now line is off the view. How do I set focus to the current time and have the current time or mark_now be in the horizontal center of the display?
I am learning dhtmlx and may not be able to answer all queries so would appreciate any guidance. Thanks in advance!
You can add something like next
scheduler.config.scroll_hour = (new Date).getHours();
It will configure scheduler to scroll day or week view to the current hour.
Related
How do I plot horizontal lines using high and low of the first one minute bar after market opens at 9:30 (NYSE time)?
Possibly I would like to plot the open, high and close of 1st 1 minute bar.
Then when first 15 minutes is done, would like to plot the high and low of that bar as well.
I tried with OHLC indicator and others, but couldn't find something to tackle exactly this.
Also the below code that I got it from chatGPT, but it got couple of errors
type here
indicator("First Minute Bar High and Low", overlay=true)
var float firstBarHigh = na
var float firstBarLow = na
// Define the regular trading hours for the NYSE in Eastern Time
var tradingHoursStart = input("09:30-5", "Trading Hours")
var tradingHoursEnd = input("16:00-5", "Trading Hours")
var tradingHoursRange = time(tradingHoursStart + ":1234567-" + tradingHoursEnd + ":1234567")
// Define the desired time in Eastern Time
var timeInET = timenow("America/New_York")
if hour(timeInET) == 9 and minute(timeInET) == 30 and timeInET >= tradingHoursRange
if barstate.isfirst
firstBarHigh := high
firstBarLow := low
```plot(firstBarHigh, "First Minute High", color=color.green)
```plot(firstBarLow, "First Minute Low", color=color.red)
I'd like to create a timer for a flutter website that counts down to a certain date.
e.g.
120 Days 12 Hours 45 Mins 15 Secs
Is that possible and can anyone help?
I haven't got a clue where to start with this one..
You can use this package
https://pub.dev/packages/countdown_flutter
Note: In this package you will see a duration property. You should locate time difference between nowDate and the other date
var nextDate = DateTime(2023, 10, 29);
var nowDate = DateTime.now();
var difference = nowDate.difference(nextDate);
I am working on my automation project where I need trigger some functionality for every 8 hours to see if the expected web element is displayed. I am using the quartz scheduler to trigger the functionality for every 8 hours.
When I run the code, the nextfireTime is displayed for the 1st iteration. once the first iteration is completed, the code is waiting for the next iteration. But the time is not printed in the log. How can do that?
StdSchedulerFactory factory = new StdSchedulerFactory();
Scheduler scheduler = factory.getScheduler();
JobDetail Job1 = JobBuilder.newJob(myJob.class).build();
Trigger t1 = TriggerBuilder.newTrigger().withIdentity("cronTrigger1","group1").withSchedule(CronSchedulerBuilder.cronSchedule ("0/3 0 0 ? * * *)).build();
while (!elementtext.contains("***************"))
{
Date Currenttime = new Date();
Date date = scheduler.schedulejob(job1,t1);
scheduler.start();
log.info(job1.key() + will run at : +t1.getNextFiretime());
}
if (elementtext.contains("**********")){
scheduler.shutdown();
}
I expect the time to be displayed after the 1st run. But it is not displayed.
I'm working on an automatic Street Light that is supposed to change based on the time. Here is the code:
--------------------------------------------
-----------Street Light Script!-------------
-----------Made by multiplemark-------------
--------------------------------------------
local ControlledByGameTime = true -- Setting to true makes it so that the lights
activate only during the selected time.
local TurnLightsOnAt = 20 * 60 -- Turns lights on at 8 P.M. by default.
local TurnLightsOffAt = 8 * 60 -- Turns lights off at 8 A.M. by default.
local Lights = script.Parent.PointLight.Enabled
local LightBlock = script.Parent
if ControlledByGameTime == true then
while true do
local CurrentTime = game.Lighting:GetMinutesAfterMidnight()
if CurrentTime >= TurnLightsOffAt then
Lights = false
LightBlock.Material = "SmoothPlastic"
LightBlock.Brick = 163,162,165
end
if CurrentTime >= TurnLightsOnAt then
Lights = true
LightBlock.Material = "Neon"
LightBlock.Brick = 255,255,0
end
end
else
Lights = true
LightBlock.Material = "Neon"
LightBlock.Color = 255,255,0
end
What it is supposed to do is check for the time, and if it meets the requirements defined, change the material and color of a model, and also enabling/disabling PointLight.
I think the issue is your if statements. You're evaluating if it's after 8 pm after you evaluate if it's 8 am. Since 8 pm (or 20 in 24-hour format) comes after 8 am (or 8 24-hour format), if a value if greater than 8 pm, it's also greater than 8 am.
What you could do is just have an equals statement instead of a greater than. So something like:
if (time==TURNOFFLIGHTS)
turnofflights ();
else if (time==TURNONLIGHTS)
turnonlights ();
That way, it only turns off the lights at the specific moment that night begins and only turns them on the moment day begins.
Example:
Time = 09:41:46
Duration = 0:00:17 (IE 17 seconds)
Start Time = Time - Duration
Clearly I can't just break this up into hours minutes and seconds and do a basic minus operation given the 60 minute hour and 60 second minute etc.
Can't seem to get my head around how to calculate this and hoping someone has come across this before :).
You can use the DateAdd function.
For example, this will subtract 17 seconds from the specified date/time.
DateAdd("s", -17, "1/1/2013 09:41:46")
Try this
Time = 09:41:46
Duration = 0:00:17
Start_Time = FormatDateTime(Time - Duration, 3)
wscript.echo hour(Start_Time)
wscript.echo minute(Start_Time)
wscript.echo second(Start_Time)
References:
https://www.w3schools.com/asp/asp_ref_vbscript_functions.asp#date