DHTMLX Scheduler Start_hour - scheduler

I have two questions related to DHTMLX
QUESTION 1: how to start_hour with minutes.
Start_hour_image
QUESTION 2: how to start_hour with PM (Post Meridiem)
Start_hour_with_pm

Minutes are not supported in first_hour config, in Day/Week/Unit views you can set only hour as a minimum value for the scale.
You can block time from 05:00 to 05:30 to prevent events creation.
Start minutes on the scale can be configured only in Timeline view.
To start from 5pm, set
scheduler.config.first_hour = 17;
It doesn't mean that current date 17:00-24:00 and the next day till 10:00 (if you set, for example, "last_hour = 10") will be rendered on the scale. You need to set values for these configs within one day. I.e. 0:00 <= first_hour < last_hour <= 24:00.

Related

Hi, I need to display data from a table (vw_tracking_resource_events), but only 14 days of data for a certain time (18:00 to 19:00)

I use PostgreSQL
I can run a single query per day, but it will take a long time to go through every day.
The "zone" and "reader" also changes, so to run single queries every time will keep me up until late.
If at best I can only change the "reader" and "zone" every time it would help. The main "PAIN" I have, is to change the dates every time. It will be from 2022 11 18 18:00 to 2022 12 01 19:00.
P.S - I'm new to SQL, please be gentle :)
My current query:
select * from vw_tracking_resource_events
where "when_enter_dt_timezone" between '2022 11 18 18:00:00' and '2022 11 18 19:00:00'
and "zone" = '085 Level'
and "site" = 'MK'
and "reader" = 'RV Shaft'
and "group" = 'Lamp'
If you cast your field to separate and compare the date part and the time part to desired ranges, it becomes super easy:
WHERE when_enter_dt_timezone BETWEEN '2022-11-18' AND '2022-12-01T23:59:59.999'
AND when_enter_dt_timezone::time BETWEEN '18:00' AND '19:00'
Edit:
#Stefanov.sm makes a very good point regarding the casting of the timestamp to type date (1st criterion above) if an index can be used to retrieve data.
I corrected the query to take his remark.
Disclaimer: With when_enter_dt_timezone::date BETWEEN ... AND 2022-12-01, you include e.g. 2021-12-01T18:30.
Without the cast, the upper bound 2022-12-01 is implicitly set to midnight (morning); you will either have to change the upper bound to 2022-12-02 (which #Stefanov.sm suggested and works very well since you have a condition on the time anyway) or set your upper bound to 2022-12-01T23:59:59.999 (which is what I did above, although only to draw your attention to this specific issue).
You can try something like this to get records for the last 14 days between 6:00 p.m. and 7:00 p.m.
select * from vw_tracking_resource_events
where when_enter_dt_timezone > current_date - interval '14' day and
when_enter_dt_timezone::time between time '18:00' AND time '19:00'
Demo in sqldaddy.io
Modified using #Atmo notes
and #a_horse_with_no_name

can we specific Ksql table start time

I have a requirement to create window that start at 5 am and last for 24 hours
I can not find a way to specify window start time , only how to define window size
if I defined it as 24 it automatically start at 12 am
any help?
ksqlDB windows start at the UNIX epoch (00:00:00 UTC on 1 January 1970) and this cannot be changed.

Cleaner way of dealing with dates in java / Quartz

In order to programmatically schedule a job one day ahead (using quartz) I had to come up with this mess of code:
Date.from(LocalDateTime.from(Instant.now()).plusDays(1).toInstant(ZoneOffset.ofHours(-3)))
Isn't there a way of making this monstruous piece of code more clean, readable?
My goal is to simple pick this moment and add one day to it, no concerns about timezones or little differences in the duration of some given days.
EDIT
To be more specific, I need a java.util.Date that represents one day more than when it is created.
The title you picked asks for dates in Java in a general sense, but your question and your tags show that you might be interested in some Quartz-specific solutions, like these (assuming you're using TriggerBuilder):
TriggerBuilder tb = ...; // initialize your tb
// Option 1
Trigger trigger = tb
.withSchedule(/* pick your flavor */)
.startAt(DateBuilder.futureDate(1, DateBuilder.IntervalUnit.DAY))
.build();
// Option 2
LocalDateTime now = LocalDateTime.now();
Trigger trigger2 = tb
.withSchedule(/* pick your flavor */)
.startAt(DateBuilder.tomorrowAt(now.getHour(), now.getMinute(), now.getSecond()))
.build();
For more info check the DateBuilder API.
There are two forms with no preference I know of for one or the other. Either this one:
Date sameTimeTomorrow = Date.from(Instant.now().plus(Duration.ofDays(1)));
Or this:
Date sameTimeTomorrow = Date.from(Instant.now().plus(1, ChronoUnit.DAYS));
Beware, however, that this adds 24 hours without any consideration of summer time or other anomalies. For example: In my time zone summer time ends in the night between October 27 and 28. So if I run the above on October 27 at 12 noon I will hit October 28 at 13 in my time zone because the time has changed. If I need to hit 12 noon again, I need:
Date sameTimeTomorrow = Date.from(
ZonedDateTime.now(ZoneId.of("America/Sao_Paulo")).plusDays(1).toInstant());
Please substitute your correct time zone.

Use External Window Time Stamp to Debug Siddhi Stream Query

I am planning to use the historical event traces (stored in JSON with my own event time stamp recorded for each event) to debug the Siddhi stream queries that I have just created. My stream starts with:
from MyInputEventStream#window.externalTime(my_own_timestamp, 10 min)
select some_fields
insert into MyOutpuStream;
and I will input my events from traces, one by one.
Supposed event 1 arrives at the specified my_own_timestamp = 1528905600000, which is 9 am PST time, June 13. and event 2 arrives at 11 minutes later, my_own_timestamp = 1528906260000. I believe that I will get the output at MyOutpuStream at 9:10 am, as time_stamp(e2) - time_stamp(e1) > 10 min, and e2 will trigger the system after the windows passes.
Now supposed event 1 arrives at my_own_timestamp = 1528905600000, that is, 9:00 am. But no events will arrive in the next 2 hours. Do I still get the output at 9:10 am, as in reality, the window time should expire at 9:10 am, independent of when the next event should arrive? But it seems that in this case, the internal timing system of Siddhi will have to incorporate my event input's time stamp, and then set the expiration time of the events based on the clock system of the process on which the Siddhi is running. Is this correct? could you help clarify it.
You won't get an output at 9:10 am. Because if you use externalTime, the event expiration logic will entirely base on the timestamp that you defined. And it will wait for a timestamp that satisfies the time difference which is greater than or equal to expire the previous event.
What internally happens is;
def array previousEvents;
foreach currentEvent in currentEvents (events that are coming in):
def currentTime = currentEvent.timestamp;
foreach previousEvent in previousEvents:
def previousTime = previousEvent.timestamp;
def timeDiff = previousTime - currentTime + windowLength;
if (timeDiff <= 0) {
remove previousEvent from previousEvents;
set expired timestamp of previousEvent to currentTime;
expire previousEvent;
}
previousEvents.add(currentEvent);

How to assign whether a specific date is during work hours or not. (SPSS)

Hi i'm new to this site so forgive me if i didn't search for this question thoroughly enough!
Basically i'm doing a research project where one of the variables is whether an xray was performed during normal work hours or not. Work hours include Monday-Friday, 8am-5pm.
I have input the date and time of each xray using separate variables
-[date+time (dd.mm.yyyy hh:mm)]
-[time (hh:mm)].
I was planning on inputing this information manually but i though that surely there is way to automate this and since i have next to zero experience with SPSS i thought i should ask you lovely people to help me out!
Thankyou in advance
Below I go through a quick example utilizing the xdate function to extract the day of week, and then construction an if statement to identify whether these date-times fall within workhours.
*Making example data.
data list free / xray_date (ADATE10) xray_time (TIME5).
begin data
7/6/2011 2:21
10/11/2011 15:42
07/06/2011 02:21
3/15/2011 0:21
end data.
*Here is example to find day of week name, 1 is Sunday and 7 is Saturday.
compute day_week = Xdate.Wkday(xray_date).
*to identify times of day in an if statement we need to make specific variables.
string begin_time end_time (A5).
compute begin_time = "08:00".
compute end_time = "17:00".
alter type begin_time end_time (TIME5).
*Then you can just make an if statement to identify whether a date-time meets your requirements.
compute workhours = 0.
if day_week >= 2 and day_week <= 6 and xray_time >= begin_time and xray_time <= end_time workhours = 1.
For this particular example, if you run the command list all. the resulting output will be;
xray_date xray_time day_week begin_time end_time workhours
07/06/2011 2:21 4.00000 8:00 17:00 .00000
10/11/2011 15:42 3.00000 8:00 17:00 1.00000
07/06/2011 2:21 4.00000 8:00 17:00 .00000
03/15/2011 0:21 3.00000 8:00 17:00 .00000
You can see the record with 10/11/2011 was appropriately classified as it is a Tuesday and within working hours. All of the other records are not between 8 am and 5 pm, so are initialized to the zero value for the workhours variable.