I am trying to get the different between two times, lets say 2:00PM and 12:00AM. So I want to get how many hours are between those two times but have it be in decimal format which in this case would be 10.00 hours?. I am not sure how to go about this. The most I got to was just subtracting the two times and multiplying that decimal number by 24 which works if I do 2PM and 11PM which gives me 9.00hours, but as soon as I go to 2PM and 12AM it should show 10.00hours but shows -14.
Assuming your times are in ColumnA ("earlier") and ColumnB ("later") then:
=if(B1=0,(B1-A1+1)*24,(B1-A1)*24)
should work for you. The quotes are because (seems to depend upon how the times values are entered) Google may associate a date with the times even when that is not displayed. Google treats noon as 12:00PM which is wrong, it is noon not after noon (post meridiem) but one minute later 12:01PM, etc, does make sense. So 12:00AM is midnight and a special case where a date is associated because seen as midnight of the previous day - it counts as 0 not 24. Hence relative to 2pm today is 14 hours earlier (your result) whereas midnight tonight is 10 ahead (the result you expected).
The formula above checks whether the later time is midnight and compensates for that being treated as the day before by +1 in the formula.
Related
I am using pytorch-forecasting for count time series. I have some date information such as hour of day, day of week, day of month etc...
when I assign these as categorical variables in TimeSeriesDataSet using time_varying_known_categoricals the training.data['categoricals'] values seem shuffled and not in the right order as the target. Why is that?
pandas dataframe is like below before going through TimeSeriesDataSet
After the following code
why has hour of day column changed to 0, 1, 12, 17?
Actually, the time_varying_known_categoricals are NOT shuffled. The categories assigned to them are not in order like 1 for 1st hour, 2 for 2nd hour etc.. that's why it feels like it has shuffled the time series. I tried to align "hour_of_day" categorical variable for 3 days. I noticed that the encoding for each hour matches correcly for each day so there is no shuffling. This information should be mentioned in the doc string atleast. It will save a lot of time and confusion.
I'm attempting to get an average number of calls/day based on yesterday's date.
My initial formula looks like this: =round(average(C24/3),2), where:
C24 = the total number of calls,
/3 = diving the contents of C24 by yesterday (assuming yesterday was the 3rd of the month),
,2 = rounding answer to 2 decimal places.
The formula itself works fine, but I have to go in daily to change the 'date' (/3, in my example).
Any suggestions as to how I can automate this formula so as to not have to go in to change the day of the month every day?
(for what it's worth, i tried using =round(average(C24/today()),2), but get a divide by zero error. Not sure what else to try. I also googled rolling averages/moving averages, but that didn't seem to help either.)
Use DAY and TODAY.
=DAY(TODAY()-1)
So
=ROUND(AVERAGE(C24/DAY(TODAY()-1)),2)
i have a date string on NodeJS
2019-02-25T09:00:00Z
I create a moment object, and set the timezone to new york
let a = moment.tz("2019-02-25T09:00:00Z", "America/New_York");
I then create another moment object, with the same time, but set a different place, arizona
let b = moment.tz("2019-02-25T09:00:00Z", "America/Phoenix");
console.log(a.diff(b));
prints out 0 milliseconds. i would expect expect to get 7200000 (2 hour time difference). why am i not getting this difference?
"2019-02-25T09:00:00Z" means "9am on February 25th 2019, UTC". The "Z" part is what indicates that the value is in UTC.
You've created two values representing the same instant in time, but in two different time zones - so they'll have different local values, but they both represent the same instant, so the difference between them is 0.
If you want to create a value which represents "9am on February 25th 2019, in the given time zone" then just remove the Z. (I don't know what Moment does if the value you specify is either ambiguous or skipped due to offset changes in the time zone, but that's something you should investigate if you're going to do this with arbitrary data.)
I'm trying to calculate the difference between a start time and a persons first action and the same for the end time and their last action.
My problem is due to having a 24 hour business I can't seem to figure out a single formula to cope with shift times and actions being anywhere in the 24 hour time frame.
Example sheet
The start times are manually imputed as "06:00" format and the Actions are taken from a Left("12/09/2017 19:08:25"),8 format.
The data entry is bad. You need to enter start and end times with its date ( You could just format it as just time for presentation purposes). But dates have to entered in and should be there below the time. For example, One of the finish times is 00:00:00 , while the expected finish time is 23:00:00. We could assume that he worked one hour late and ended his shift by start of tomorrow. But spreadsheets cannot assume. It would think that he finished by today morning 00:00:00 instead of his actual finish time tomorrow morning 00:00:00. So he went off early by 23 hours. Once that's fixed, You could simply find the difference between the two times. But, You have to format that column as number>Duration instead of Time.
To sum up,
Add dates to start and end times
Format the resulting difference column as Number>Duration.
I already have a graph (time tree) that contains Year, Month, Day, Hour and Minutes. It is something like that of what Mark Needham shows in his blog link but it goes until Minutes instead of days. So the link looks something like this :
2017-[:HAS_MONTH]-2-[:HAS_DAY]-25-[:HAS_HOUR]-16-[:HAS_MINUTE]-45
I also have Year to week number relation. The starting and ending dates of the Workweek are custom. For eg my week 2 in 2017 starts from 2017-01-05 19:00 (yyyy-mm-dd hh:mm) and ends on 2017-01-12 18:59. I have all the nodes between those 2 dates in my time tree but I am not able link them to week 2 node. Is there a way to do this? I am not using graphaware. I managed to do something for this one week by collecting all the days from 5th to 12th and then removing the hours 0 to 18 from 5th and 20th to 23rd on 12. But I need to do this for a couple of years and this method may be very cumbersome. Is there a better way for this?
You can use apoc plugin already :)
apoc.date.format uses JAVA simpledateformat under the hood I think. Looking at http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html this is already possible. But you have to first parse it into unix and then back.
with "2017-01-05 19:00" as date
with apoc.date.parse(date,"s","yyyy-MM-dd HH:mm") as unix
return apoc.date.format(unix,"s","yyyy ww")