I'm using the Office 365 Management API to get available content (audits) between dates but I keep getting events from the last 24 hours.
This is the url I'm using:
/subscriptions/content?contentType=Audit.Exchange&startTime=2017-08-11&endTime=2017-08-12
I tried using all date formats listed in the documentation
YYYY-MM-DD
YYYY-MM-DDTHH:MM
YYYY-MM-DDTHH:MM:SS
I also tried switching the start and end (from the later to the earlier).
Another thing I tried is giving a range of less than 24 hours in the last 24 hours.
But I still get the entire last 24 hours.
So although the Microsoft documentation shows an escaped & char the correct url is with only the & char like this:
/subscriptions/content?contentType=Audit.Exchange&startTime=2017-08-11&endTime=2017-08-12
Related
I'm logging calls, emails and meetings using Google sheets. I am trying to get a chart of results based on a number of days in the past, 7, 30, last month, current month, etc. I am able to do exactly what I need to do using a fixed date but I can't figure out how to convert that to a date range.
Here is what is working:
={ARRAYFORMULA({UNIQUE(FILTER(CRM!M2:M2510,CRM!N2:N2510>=VALUE("2018-06-01 00:00:00"),CRM!N2:N2510<=VALUE("2018-08-01 23:59:59"),CRM!M2:M2510<>"")),ARRAYFORMULA(COUNTIF(FILTER(CRM!M2:M2510,CRM!N2:N2510>=VALUE("2018-06-01 00:00:00"),CRM!N2:N2510<=VALUE("2018-08-01 23:59:59")),SUBSTITUTE(SUBSTITUTE(UNIQUE(FILTER(CRM!M2:M2510,CRM!N2:N2510>=VALUE("2018-06-01 00:00:00"),CRM!N2:N2510<=VALUE("2018-08-01 23:59:59"),CRM!M2:M2510<>"")),"*","~*"),"?","~?")))})}
I need to change the value from a fixed date to a number of days in the past. What do I need to change in this formula? I tried using TODAY() -7 but I keep getting an error saying that I am missing brackets. When I use (TODAY()-7) I just get an #ERROR.
How can I change the VALUE("fixed date") to VALUE(TODAY -7)?
If your data looks like "2018-06-01 00:00:00".
Then use this conditions for filter to filter the last 7 days:
Arrayformula(datevalue(left(CRM!N2:N2510),10))>=datevalue(today()-7)
,
Arrayformula(datevalue(left(CRM!N2:N2510),10))<=datevalue(today())
i have created a dashboard in klipfolio and only need 52 weeks data to be fetched by the api with respect to current date .. currenlty i m manualy passing date but i want it to use the system date to automaticall fetch data for me
"dateFrom": "2018-01-10",
"dateTo": "2018-02-05",
You can use Klipfolio's date parameters to accomplish this. In your example, you want the last 52 weeks from today so your query for dates could look like this:
"dateFrom": "{date.addWeeks(-52).format()}", "dateTo": "{date.today}",
Alternatively, if you want it to start on first day of the week 52 weeks ago, your query for dates could look like this:
"dateFrom": "{date.addWeeks(-52).startOfWeek.format()}", "dateTo": "{date.today}",
This will create a 52 week rolling window relative to today so you will not have to update your query every week.
I'm currently struggeling with the Microsoft Graph REST-API.
What I'm trying to do is list todays events (happening between midnight and midnight). From the documentation, the filter function is very limited.
My current statement looks like this:
https://graph.microsoft.com/v1.0/me/events?$top=100&$select=*&$filter=start/DateTime ge '2017-10-31T00:00:00' AND end/DateTime le '2017-11-1T00:00:00'&$orderby=start/DateTime ASC
The interesting part is here $filter=start/DateTime ge '2017-10-31T00:00:00' AND end/DateTime le '2017-11-1T00:00:00' using the start and the end and checking if start >= TODAY AND end <= TODAY+1. That's all working great for dates that are shorter as 1 day.
My problem is now how to get events that last longer than one day e.g. start = YESTERDAY and end = NEXT WEEK. Which means the start date is before today and the end day is as well not included in this range.
How to get this events?
I believe you should be using Calendar View for your scenario:
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/calendar_list_calendarview
The link that Yogesh referenced seems to be removed and not found. Here is the link that I used which shows how to use the calendar view. Hopefully this helps -- https://learn.microsoft.com/en-us/graph/api/calendar-list-calendarview?view=graph-rest-1.0&tabs=http
i have problems getting the right time difference for a given route and a departing and arrival time plus the timezones.
My route is Vienna to Washington D.C. Departing time from Vienna is 10.09.2014 10:25 (vienna time) and arrival time is 10.09.2014 14:20 (washington time)
The timezone for both are Europe/Vienna and US/Eastern.
I use momentjs + momentjs/timezone to get the right values. But momentjs is returning the wrong value in minutes.
The correct value should be 595 Minutes makes 9h 55m.
This is the line i tried:
moment( '10.09.2014 1420', 'DD.MM.YYYY HHmm').tz( 'US/Eastern').diff( moment( '10.09.2014 1025', 'DD.MM.YYYY HHmm').tz( 'Europe/Vienna'), 'minutes');
I tried even with moment.tz( date, format, timezone).diff( ...) but this returns 235 too.
Why it returns 235 ?
You can easily test this on the momentjs.com/timezone site by using the console in your webdev toolbar.
What am i doing wrong here? Both times i have are always local airport time, and i want the time difference in minutes.
Just to close this question.
The timezone data was missing. Be careful when using and building momentjs. Check that you are building including timezone data.
In my case i had to use a specific set of languages too. So i had a custom grunt call in order to build.
Now it works.
Trying to parse and XLSX file using roo gem in a ruby script.
In excel dates are stored as floats or integers in the format DDDDD.ttttt, counting from 1900-01-00 (00 no 01). So in order to convert a date such as 40396 - you would take 1900-01-00 + 40396 and you should get 2010-10-15, but I'm getting 2010-08-08.
I'm using active_support/time to do calculation like so:
Time.new("1900-01-01") + 40396.days
Am I doing my calculation wrong or is there a bug in active support?
I'm running ruby 1.9.3-mri on Windows 7 + latest active_support gem (3.2.1)
EDIT
I was looking at the older file in Excel with the wrong data - my script / console were pulling the right data - hence my confusion - I was doing everything right, except for using the right file!!!! Damn the all-nighters!
Thanks to everyone replying, I will keep the question here in case somebody needs info on how to convert dates from excel using ruby.
Also for anyone else running into this - spreadsheet gem DOES NOT support reading XLSX files at this point (v 0.7.1) properly - so I'm using roo for reading, and axlsx for writing.
You have an off-by-one error in your day numbering - due to a bug in Lotus 1-2-3 that Excel and other spreadsheet programs have carefully maintained compatibility with for 30+ years.
Originally, day 1 was intended to be January 1, 1900 (which would, as you stated, make day 0 equal to December 31, 1899). But Lotus incorrectly considered 1900 to be a leap year, so if you use the Lotus numbers for the present and count backwards, correctly making 1900 a common year, the day numbers for everything before March 1st, 1900, are one too high. Day 1 becomes December 31st, 1899, and day 0 shifts back to the 30th. So the epoch for date arithmetic in Lotus-based spreadsheets is really Saturday, December 30th, 1899. (Modern Excel and some other spreadsheets extend the Lotus bug-compatibility far enough to show February 1900 actually having a 29th day, so they will label day 0 "December 31st" while agreeing that it was a Saturday! But other Lotus-based spreadsheets don't do that, and Ruby certainly doesn't either.)
Even allowing for this error, however, your stated example is incorrect: Lotus day number 40,396 is August 6th, 2010, not October 15th. I have confirmed this correspondence in Excel, LibreOffice, and Google sheets, all of which agree. You must have crossed examples somewhere.
Here's one way to do the conversion:
Time.utc(1899,12,30) + 40396.days #=> 2010-08-06 00:00:00 UTC
Alternatively, you could take advantage of another known correspondence. Time zero for Ruby (and POSIX systems in general) is the moment January 1, 1970, at midnight GMT. January 1, 1970 is Lotus day 25,569. As long as you remember to do your calculations in UTC, you can also do this:
Time.at( (40396 - 25569).days ).utc # => 2010-08-06 00:00:00 UTC
In either case, you probably want to declare a symbolic constant for the epoch date (either the Time object representing 1899-12-30 or the POSIX "day 0" value 25,569).
You can replace those calls to .days with multiplication by 86400 (seconds per day) if you don't need active_support/core_ext/integer/time for anything else, and don't want to load it just for this.
"Excel stores dates and times as a number representing the number of days since 1900-Jan-0, plus a fractional portion of a 24 hour day: ddddd.tttttt . This is called a serial date, or serial date-time." (http://www.cpearson.com/excel/datetime.htm)
If your column contains a date time, rather then just a date, the following code is useful:
dt = DateTime.new(1899, 12, 30) + excel_value.to_f
Also keep in mind that there are 2 modes of dates in an excel worksheet, 1900 based and 1904 based, which typically is enabled by default for spreadsheets created on the mac. If you consistently find your dates off by 4 years, you should use a different base date:
dt = DateTime.new(1904, 1, 1) + excel_value.to_f
You can enable/disable 1904 date mode for any spreadsheet, but the dates will then appear off by 4 years in the spreadsheet if you change the setting after adding data. In general you should always use 1900 date mode since most excel users in the wild are windows based.
Note: A gotcha with this method is that rounding might occur +/- 1 second. For me the dates I import are "close enough" but just something to keep in mind. A better solution might use rounding on fractional seconds to solve this issue.
You're doing your calculation wrong. How do you arrive at the expected result of 2010-10-15?
In Excel, 40396 is 2010-08-06 (not using the 1904 calendar, of course). To demonstrate that, type 40396 into an Excel cell and set the format to yyyy-mm-dd.
Alternatively:
40396 / 365.2422 = 110.6 (years -- 1900 + 110 = 2010)
0.6 * 12 = 7.2 (months -- January = 1; 1 + 7 = 8; 8 = August)
0.2 * 30 = 6 (days)
Excel's calendar incorrectly includes 1900-02-29; that accounts for one day's difference between your 2010-08-08 result; I'm not sure about the reason for the second day of difference.