AnsweredAssumed Answered

PI WEB API Time Settings

Question asked by heinzea on Sep 22, 2020
Latest reply on Sep 25, 2020 by Roger Palmen

Hello,

 

I'm having a problem with my Pi WEB API applications. I need different time settings depending on the current day.

According to my code

 

try
{
start = startDate.ToString("dd/MMM/yyyy");

end = endDate.AddDays(1).ToString("dd/MMM/yyyy");
searchmode = " start:>" + start + " start:<" + end;

string query = "Template:=" + template + searchmode;
eventFrames= eventFrame.PIRequest(database + "query=" + query);
}
catch (Exception ex){
try
{
start = startDate.ToString("MMM-dd-yyyy");

end = endDate.AddDays(1).ToString("MMM-dd-yyyy");
searchmode = " start:>" + start + " start:<" + end;

string query = "Template:=" + template + searchmode;
eventFrames = eventFrame.PIRequest(database + "query=" + query);
}
catch(Exception e)
{
start = startDate.ToString("yyyy.MM.dd");

end = endDate.AddDays(1).ToString("yyyy.MM.dd");
searchmode = " start:>" + start + " start:<" + end;

string query = "Template:=" + template + searchmode;
eventFrames = eventFrame.PIRequest(database + "query=" + query);
}
}

The query for PI Web API is like following: https://<Server>/piwebapi/eventframes/search?databaseWebId=<uniqID>&query=Template:=<Template> start:>25.Mrz.2020 start:<24.Sep.2020.

 

On Mondays I need the last time format, On Wendsday i need the first one and on friday the mid one. Can sombody can explain me, why I need different time format on different days. Is there any option where I can set a default time format? Is there any settings possibilties in http header?

Outcomes