Date format in HTTP GET for test/runs azure DevOps API query - azure-devops

I'm attempting to call the Azure DevOps API to determine the outcome for test runs using the URL, narrowing the results to a single releaseEnvId:
https://dev.azure.com/organisation/project/_apis/test/runs?api-version=5.0&releaseEnvIds=12345&minLastUpdatedDate=2019-05-17T14:00:00.910Z&maxLastUpdatedDate=2019-05-15T14:00:00.910Z
The API request requires two mandatory date-time fields, but the doc at https://learn.microsoft.com/en-us/rest/api/azure/devops/test/runs/query?view=azure-devops-rest-5.0 does not specify the format:
maxLastUpdatedDate
minLastUpdatedDate
The date-time format I am specifying is wrong because the error comes up:
{"$id":"1","innerException":null,"message":"Invalid dates specified.","typeName":"Microsoft.TeamFoundation.TestManagement.WebApi.InvalidPropertyException, Microsoft.TeamFoundation.TestManagement.WebApi","typeKey":"InvalidPropertyException","errorCode":0,"eventId":3000}
As I understand the doc, the min date must be less than 7 days from the max. if I add garbage to the date formats then it produces a proper date parsing error.

The format you provided it's good but in your example the minLastUpdatedate (5/17) it's after the maxLastUpadeDate (5/15) in it should be the opposite. try to replace the values and it should work.
BTW - you specified the date in the full format, the API should works also with date only - 2019-05-15 or with a time - 2019-05-15T14:00:00.

Related

ElasticSearch Custom Date format Configuration in Helm Chart

I'm using elastic search with fluentd.
When the fluent plugin for elastic search sends data to elasticsearch for my etcd kubernetes pod, it rejects it with the following error
error_class=Fluent::Plugin::ElasticsearchErrorHandler::ElasticsearchError error="400 - Rejected by Elasticsearch [error type]: mapper_parsing_exception [reason]: 'failed to parse field [ts] of type [float] in document with id '6EqJ_IIB3e6EJskEmVw_'. Preview of field's value: '2022-09-02T04:50:46.111Z''"
From the docs: Date
JSON doesn’t have a date data type, so dates in Elasticsearch can either be:
strings containing formatted dates, e.g. "2015-01-01" or "2015/01/01
12:10:30". a number representing milliseconds-since-the-epoch. a
number representing seconds-since-the-epoch (configuration).
Internally, dates are converted to UTC (if the time-zone is specified) and stored as a long
number representing milliseconds-since-the-epoch.
Queries on dates are internally converted to range queries on this
long representation, and the result of aggregations and stored fields
is converted back to a string depending on the date format that is
associated with the field.
Date formats can be customised, but if no format is specified then it
uses the default:
"strict_date_optional_time||epoch_millis" This means that it will accept dates with optional timestamps, which conform to the formats
supported by strict_date_optional_time or
milliseconds-since-the-epoch.
The following formats are supported : formats
Completely customizable date formats are supported. The syntax for these is explained DateTimeFormatter docs.
I want my elastic search to be able to parse a date like: 2022-09-02T04:50:46.111Z
But I have not been able to find a way to inject this format in elasticsearch configurations through a helm Chart.
How can we do it??

Matters.json date range filter

The Clio APIV4 documentation is not very clear to me on what is expected for creating a date range filter for the open_date field in a call to matters.json.
Can someone give me some guidance on what is expected for the filter for something like a range of all matters opened between 1/1/2019 and 1/15/2019? I also don't see if the dates are expected an ISO-8601 timestamp or not.
In case someone else has this issue - I received this from Clio support:
*An example of a request for your Matters data where the Open Date lies between 01/01/2019 and 01/08/2019 would be as follows:
app.clio.com/api/v4/matters?fields=&open_date[]=>2019-01-01&open_date[]=<2019-08-01
As you can probably tell from that example, the dates you are filtering for do not need to be a timestamp. It can just be a date in the format of YYYY-MM-DD.*

Qlik Sense: Change date field format from Google Analytics API

I've pulled in data in Qlik Sense (cloud) from the Google Analytics connector. I'm trying to convert the standard date [ga_dateHourMinute] field to a more eligible date format.
The current format is YearMonthDayhHourMinute, for instance: 201810250004, I would like to convert this to the standard date format 2018-10-25 00:04:00. How do I do this? Answers concerning methods in the data load script or master formula's or variables are all welcome.
Click to see screenshot: left = current date format and right = desired date format
This is one approach:
DateAlter:
LOAD * INLINE [
Date
201810250004
];
DateAlter2:
LOAD
Date(Date#([Date], 'YYYYMMDDhhmm') ,'YYYY-MM-DD hh:mm') AS [MyDateField]
Resident
DateAlter;
If you haven't played around with the data manager, it will allow you to edit fields and handle dates in a fairly easy manner:
Qlik Sense Data Manager
I ended up creating a text fields that combined the different digits from the one field into a new order, then pushed the data format into a date/time. Quite a bit of work, but fairly solid.

How do you determine the format for crystal date parameters?

So I'm using a windows script to use Visual Cut to run a report. That report takes in two date parameters (along with additional params). The script was working when I first tested it, but when I went to demonstrate it to a co-worker it stopped. It turns out that Crystal/Visual Cut needed the date parameter in a different format (initially dd/mm/yyyy worked, but now it requires yyyy/mm/dd). How does Crystal decide what format it needs, and how can I make sure my input adapts to that format?
EDIT: Current workaround is to require 'yyyy/mm/dd' format, and I changed the type on the parameters in the report from dates to strings, and then I explicitly call cdate on the values. I just want to know
a) Where the datemask used for date parameters comes from and
b) If passing 'yyyy/mm/dd' to cdate will ever fail (assuming a valid date).
Passing string values and converting them to date, time , number etc might be a problem because you have no control over the user settings. Check what is the difference between the default date format on both computers.

IBM i (AS400/ISeries) - Adding days to date field in WRKQRY

I have a decimal date field (TDDATR) that is in the YYYYMMDD format.
I would like to create a field that is TDDATR + 30 days but I am unable to.
Using 'Define Results Field' I have tried a few things;
Simply doing this;
TDDATR + 30 DAYS
But it returned this error: Labeled duration not used correctly.
I tried using the DIGITS and SUBSTR commands to create a field in the DDMMYYYY format and then +30 days but got the same error.
Same as above but in the DD/MM/YYYY format - same error.
Using DATE(TDDATR) but all I see is +'s in the field.
Using DATE( ) on the fields created in step 2 and 3 - still get +'s
I've ran out of ideas - any help would be greatly appreciated.
Query/400 lacks a lot of the features that an SQL based interface has.
I'd urge you to consider switching to Query Manager (STRQM) which is a fully SQL based product. You can even convert Query/400 queries to Query Manager queries with the RTVQMQRY command by having the ALWQRYDFN parm set to *YES.
The other option that IBM is pushing is Web Query. Again, fully SQL based and you can convert Query/400 queries into it.
Having said that, the problem is that FLD + 30 DAYS only works when FLD is a DATE data type. Query/400 includes a DATE() function to convert non-date types into date. But it's very limited in that it only works with character fields formatted according to your job defaults. Assuming you're in the US, it'd only work with a character value of '07/01/15'.
You could do a lot of manipulation in Query/400 and end up with a result field that meets DATE()'s requirements. But a better solution would be to create an SQL view over your table and have your numeric date converted into a date data type in the view.
You can find code examples that show how to convert a numeric YYYYMMDD to a actual date data type in the view. However, I'd recommend create a user defined function (UDF) that will do the conversion for you. That will make it much easier to use in the view and to reuse in other places.
If you'd like, there's an open source package called iDate, that includes all the code required for convert to/from date data types.
Download that, install/compile it and your SQL view becomes
select ... idate(TDDATR,'*CCYMD') as TD_DATE
from myfile
The use of days is as follow
Field Expression
CURDATE_30 days(current(date)) + 30
The solution to your problem is: given the field A dec(8,0)
Field Expression
YYYYMMDD_ date(substr(digits(a),5,2)||'/'||
substr(digits(a),7,2)||'/'||
substr(digits(a),3,2))
NEXT_MONTH DAYS(YYYYMMDD_) + 30
Remember to check the date format in your job description. In the example the format is MDY or MM/DD/YY.
More info here
Based on the information here, I created the below 2 fields;
TDDIGI DIGITS(TDDATR)
TDDAT1 SUBSTR(TDDIGI,7,2)||'/'||
SUBSTR(TDDIGI,5,2)||'/'||
SUBSTR(TDDIGI,3,2)
From here I was able to create a date field;
TDDAT2 DATE(TDDAT1)
Which allowed me to perform the necessary calculations.
The format of TDDAT1 is based on your job description which can be found by;
WRKJOB
Option 2
Page down
Date format..: X
Mine was *DMY, so TDDAT1 was formatted based on this.