DateFrom DateTo Format - nba-api

I'm currently trying to use the endpoint player game logs in order to retrieve the game stat of a specific player throw a particular period of time.
so I want to use the attributes date_from_nullable and date_to_nullable and the problem is I always get an error
I wonder what is the correct format for these two attributes?

"m/d/yyyy"
Example: start='10/6/2019', end='10/7/2019'

Related

How to controll time indepedently from time on users phone in my firebase app?

I have a Flutter app where users can predict the outcome of a soccer match. The problem is that if the user changes the time on their phone they can still predict even after it has ended. How do I prevent this so that it's independent of the time on each user's phone?
Thank you
the solution is to not get the date from the local device, but get it from the firebase timestamp that it offers, as example if we say that you want to do it from now until tomorrow at the same time, you can save it to your DB, using:
Timestamp(Timestamp.now().millisecondsSinceEpoch , 24*60*60*1000)
in your case, you need to compare the Timestamp we set in the database with:
FieldValue.serverTimestamp()
also, you can get a DateTime from a Timestamp with this:
final firestoreTimestamp = /* the Timestamp object */;
firestoreTimestamp.toDate();
The safest and most recommended approach for this is to use database rules.
Patiently study this https://fireship.io/snippets/firestore-rules-recipes

How to modify from and to values in grafana

I am having troubles understanding how the following works
from=now-1h&to=1568789063000
but when I do
from=1568789063000-1h&to=1568789063000 it doesn't work.
I have tried doing it directly in the URL, doesn't work.
from=1568789063000-1h&to=1568789063000 and from=1568789063000-2h&to=1568789063000 shows me the same time range on the graph whereas
from=now-1h&to=1568789063000 and from=now-2h&to=1568789063000 shows me different time range in the graph.
Additionally, I also tried manipulating this by using the option Data link in the visualization where I tried using
from=${__value_time}-1h&to=${__value_time} and I don't plan to use __url_time_range becasue I want custom time range around one point.
Can please anyone explain what I am doing wrong or what am I missing?
The Unix timestamps you're using (1568789063000) all translate to the same time. So doing from=1568789063000&to=1568789063000 doesn't return a valid period of time as
1568789063000 - 1568789063000 = 0
now-1h and now-2h will show different time ranges because you're telling Grafana to start the graph either at one or two hours before the time that you're making the render request, even if the to time is always the same
As for the issue using the absolute timestamp with a relative "offset" (1568789063000-1h), this isn't allowed. Instead you should subtract 3600000 from the starting (from) timestamp which equals 1568785463000. So, if you do from=1568785463000&to=1568789063000, it should work instead of from=1568789063000-1h&to=1568789063000.
Similarly for -2h, you should subtract 7200000: from=1568781863000&to=1568789063000.

Tableau Volume calculation based on Start Date and End Date

Using Tableau, I need to create a visualisation that shows me the total volume of started and ended work items per day.
Typical sql data consists of columns for each:
Reference (Unique Work Item Reference)
Start Date (Date Work Item Started)
End Date (Date Work Item Finished)
For example, if on the 6th of April 2018, 55 work items were started and 5 items were finished. Each represented date should show in its own line over time.
The issue I'm getting at the moment, when I have start date as a continuous column, it calculates the number of work items started for the end date and not the number of items finished for the end date.
Any help guidance would be greatly appreciated.
Tableau Public Link
This is a simple problem if you correct the shape of your data. You can achieve this by using the pivot functionality in Tableau or Custom SQL(If your data source does not support pivot).
Pivot the date columns
2. Rename the pivoted fields
Now build the view as below.(null values are due to tasks that are not yet closed, you can just filter it out)
I assume that the data is of this form Data structure
With this format, you could achieve something like this Gantt Chart
If you notice, I have created a calculated field called "Duration" which is in size shelf.
the calculated field reads
If [Status]="Finished" then
[End Date]-[Start Date] ELSE
TODAY()-[Start Date]
end
Hope this helps! Let me know if this is not clear enough
Even if the Status column is not there in the data source, it can be added using the following code
if ISNULL([End Date]) then
"WIP" else "Finished" end
Also, is this how you want to see the information?
Click here
Could you please have a look at it and let me know your thoughts?
https://us-east-1.online.tableau.com/t/tableaumanoraj/views/VolumeExample/Dashboard1?iframeSizedToWindow=true&:embed=y&:showAppBanner=false&:display_count=no&:showVizHome=no

Is there a way to check date dynamically in eloqua?

Context: I am using Microsoft Dynamics (CRM) and Eloqua to send email campaigns. I have a date field in CRM that I want to check against in Eloqua for a specific campaign. This campaign needs to check to see if the date field is <= today's date + 90 days. I am using the campaign UI in Eloqua, not doing anything programmatically at this point.
I have tried using the Compare Custom Object Fields decision in Eloqua by finding the date field, setting the comparator to dynamically on or before, and I want to make the compared value Today + 90 days. I'm not sure how to accomplish this in this type of Decision object because the only options I have to compare the date field to are Yesterday, Today, or Tomorrow. See image below:
I have also tried to use the Compare Date Decision object, but there is no dynamic comparison, just hard-coded date options.
The last thing I tried was a Wait step, but that only waits a hard-coded number of days rather than checking dynamically.
Has anyone run into this issue or know of a solution to this problem?
We were able to find an Eloqua Date App to download that adds a Date Decision step to the program builder which allowed us more flexibility with comparing dates in a custom range.

Server-side Fetchxml returns different results

One of our procedures lets users bulk-insert related records by picking a view and then hitting a ribbon button. The form is saved, a flag is set, and a plugin then does its job.
We are using a subgrid with a view selector to let users pick or create their own views on the fly. Once a view is selected, the number of results (provided is lte 5k) is shown.
When a plugin runs the very same fetchxml server side (Retrieve of userquery or savedquery, then Retrieve + FetchExpression), the results change. We get not only a different number of records but also some records are different.
We concluded that the issue has to do with timezones. Some filters included "on-or-after" operators along with date values.
Example:
<filter type="and">
<condition attribute="modifiedon" operator="on-or-after" value="2011-01-01" />
<condition attribute="modifiedon" operator="on-or-before" value="2011-12-31" />
</filter>
The plugin ran as admin. Changing the plugin user has no effect - as if the current user timezone is not considered when pulling out records from the CRM using a FetchExpression.
How can I ensure that a fetchxml expression returns the same results client-side and server-side?
Probably related: MSDN thread.
Thanks for your time.
Edit: following Daryl's suggestion, I ran a SQL trace. Results are puzzling. Dates are correctly offset for client-side queries (ran from CRM, i.e. Advanced Find) - this means the fetchxml is correctly translated using the user's timezone settings. This does not happen for the same query, server-side; the output SQL contains the date filters "as-is", with no timezone offset. I assumed the same translation happened no matter the origin of the query execution context.
Edit 2: A flag in an hidden region of code (my last debugging resort) was preventing the plugin from instantiating the service in the running user's context. Everything runs fine now. Thanks everyone for your time and your help, it's much appreciated.
When working with dates, always remember to convert to utc since that is how CRM stores them in the database.
The native CRM Advanced find is going to look at whatever the current user's time zone is, and convert that whatever time they enter into the advanced find to UTC before performing a SQL query. Your plugin control will need to do the same thing. These are the steps you'll need to perform before putting the criteria in the Fetch Xml / Linq Expression / Query Expression.
Get the user's UserSetting.TimeZoneCode via their SystemUserId.
Lookup the TimeZoneDefinition.StandardName for the TimeZoneCode from step 1
Call TimeZoneInfo.FindSystemTimeZoneById() passing in the Standard Name from step 2 (you can combine steps 1 and 2 into a single query, but I prefer to cache the results of step three using the input from step 1 for a slight performance improvement. ie. use a dictionary with the TimeZoneCode as the key and the TimeZoneInfo as the value)
Use this function to get the UTC value for the time that you're going to use in your plugin query:
public static DateTime ConvertTimeToUTC(DateTime time, TimeZoneInfo timeZone)
{
if (time.Kind != DateTimeKind.Unspecified)
{
// If the DateTime is created with a specific time zone(ie DateTime.Now), getting the offset will
// blow chow if it isn't the correct time zone:
// The UTC Offset of the local dateTime parameter does not match the offset argument.
//Parameter name: offset
// This quick check will recreate the serverLocal time as unspecified
time = new DateTime(
time.Year,
time.Month,
time.Day,
time.Hour,
time.Minute,
time.Second,
time.Millisecond);
}
var offest = new DateTimeOffset(time, timeZone.GetUtcOffset(time));
return offest.UtcDateTime;
}