IF TIME NOT BETWEEN SHEETS - function

this is my first thread in this forum.
i want to ask, the proper functions on google sheets to calculate this "SLA" Column.
the case i facing is, i want made the "SLA" Column refers to "Start Time" is not between work hour ( 07.00 AM To 17.00 PM ). or the simple word is whenever start time not in work hour the SLA will shows zero or 00:00:00.
also i have start time and end time to calculate to the "SLA".
how to combine those functions, so i can get the result if on work hour or off work hour
thanks
the tables

Related

Add one date to date in MySql

I am setting up a MySQL (Maria) where I am going to upload demo data for an application. In the demo date there will be many different dates from the last 6 months.
What I need to do is to keep all dates the same number of days from today all the time. So a date that is x number of days earlier or later than today keep that interval constant.
The demo data will be used in a PHP application so it is maybe an option to run PHP code to change the dates every day, or is it best done any other way?
I have been trying to just add +1, but it does not work on dates.

MYSQL How to add an auto-decrement Schedule on MySql?

I am trying to do some automatic function on MySql.
I need that all arrows of a column named vipdays decrease by 1 on a daily basis.
I mean.. today the values of all arrows of the column vipdays = 30
Tomorrow all values = 29.. next day 28... and I need that this function
be automatic, that works without manually removing 1 day.
I have made some research and found some MySql Scheduler that automate
some functions but can't make it to work.
Any Ideas?
You should create EVENT that is executed once a day and enable scheduler (it is disabled by default).
It should work.
However, do you really want to do this?
You can store expire date in database instead of the number (ex: "DATE_ADD(CURDATE(), INVERVAL 30 DAYS)") and then compare it with CURDATE() to check if it is expired.

Time Trigger Copy Paste

I'm fairly new to Google scripts and so far I only have a functional understanding of 'onEdit'. I want to incorporate Google's time triggers however I don't know how to do it due to lack of understanding.
Here is what I am trying to do:
Objective: Create a spreadsheet that keeps track of metrics on a weekly basis
Current Set up: Currently, the spreadsheet uses 'CountIF' on a queried spreadsheet from multiple users to compile all the data and determine the status of every to-do item at any moment.
Need: I would like to set up a script that takes affect every Sunday. The script would copy the metrics from the previous week and paste them into a row below based upon the start date and date date of the previous week (Which are kept in columns A ad B...Ex: 7/7/2018 & 7/14/2018. If the previous week falls into this date range, the cumulative metrics for that week will paste into columns C-L of that week.
Essentially, row 3 would always keep the running total and then the rows below row 3 would populate with a "total to date" for the given date range.
In your Apps Script editor go to Edit > Current Projects Triggers and select Time Driven > Week Timer.

How to get post_impression_organic by hour, day or time period?

I am trying to get a statistic of post_impressions_* by a time frame (hour, day, etc) but all I seem to get is "lifetime"
{post_id}/insights/post_impressions_organic/lifetime
If I try anything other than lifetime, like week or day, I get nothing, and even if I could get lifetime, not sure how to break it down by day, or hour.
For example:
- impressions
-- day 3/25: 100
-- day 3/26: 200 total: 300
Unfortunately, you can't. Please check out Facebook docs: https://developers.facebook.com/docs/graph-api/reference/insights/
At this document you'll find all different metrics and the period you can use for each one. As you can see, post_impressions_organic* only offers "lifetime" period. You should see "day" or "week" on the period column in order to use a different period.
I hope it helps.

MySQL Database Structure For Employee Timeclock

I'm working on an app that is partly an employee time clock. It's not too complex but I want to make sure I head in the right direction the first time. I currently have this table structure:
id - int
employee_id - int (fk)
timestamp - mysql timestamp
event_code - int (1 for clock in, 0 for clock out)
I've got everything working where if their last event was a "clock in" they only see the "clock out" button and visa-versa.
My problem is that we will need to run a report that shows how many hours an employee has worked in a month and also total hours during the current fiscal year (Since June 1 of the current year).
Seems like I could store clock in and outs in the same record and maybe even calculate minutes worked between the two events and store that in a column called "worked". Then I would just need to get the sum of all that column for that employee to know how much time total.
Should I keep the structure I have, move to all on one row per pair of clock in and out events, or is there a better way that I'm totally missing?
I know human error is also a big issue for time clocks since people often forget to clock in or out and I'm not sure which structure can handle that easier.
Is MySQL Timestamp a good option or should I use UNIX Timestamp?
Thanks for any advise/direction.
Rich
I would go with two tables:
One table should be simple log of what events occurred, like your existing design.
The second table contains the calculated working hours. There are columns for the logged in and logged out times and perhaps also a third column with the time difference between them precalculated.
The point is that the calculation of how many hours an employee has worked is complicated, as you mention. Employees may complain that they worked longer hours than your program reports. In this case you want to have access to the original log of all events with no information loss so that you can see and debug exactly what happened. But this raw format is slow and difficult to work with in SQL so for reporting purposes you also want the second table so that you can quickly generate reports with weekly, monthly or yearly sums.
Is MySQL Timestamp a good option or should I use UNIX Timestamp?
Timestamp is good because there are lots of MySQL functions that work well with timestamp. You might also want to consider using datetime which is very similar to timestamp.
Related
Should I use field 'datetime' or 'timestamp'?