How does PI time syntax work?
How does PI time syntax work?
PI System uses a flexible time syntax across all its tools — PI DataLink, AF Analytics, PI Web API, and more.
Absolute Time
Standard date-time formats:
2024-01-15T10:30:00Z -- ISO 8601 with UTC
15-Jan-2024 10:30:00 -- PI classic format
01/15/2024 10:30:00 AM -- US format
Relative Time (Most Common)
Relative to now (*):
* -- right now
*-1h -- 1 hour ago
*-30m -- 30 minutes ago
*-1d -- 1 day ago
*-7d -- 7 days ago
*+2h -- 2 hours from now
Named Times
t -- start of today (midnight)
y -- start of yesterday
t+8h -- today at 8:00 AM
y+16h30m -- yesterday at 4:30 PM
Time Units
| Abbreviation | Unit |
|---|---|
s | seconds |
m | minutes |
h | hours |
d | days |
w | weeks |
mo | months |
y | years |
In AF Analytics
TagAvg('Temperature', 't', '*') -- average from midnight to now
TagMax('Pressure', '*-24h', '*') -- max in last 24 hours
TagTot('Flow', 'y', 't') -- total over yesterday
TagVal('Level', '*-1h') -- value 1 hour ago
In PI Web API
Used in query parameters:
/streams/{webId}/recorded?startTime=*-1d&endTime=*
/streams/{webId}/summary?startTime=t&endTime=*&summaryType=Average
/streams/{webId}/interpolated?startTime=*-8h&endTime=*&interval=15m
In PI DataLink
Enter directly in time cells:
Start Time: *-7d
End Time: *
Interval: 1h
Common Patterns
| Need | Start Time | End Time |
|---|---|---|
| Last hour | *-1h | * |
| Today so far | t | * |
| Yesterday | y | t |
| Last 7 days | *-7d | * |
| Last shift (8h) | *-8h | * |
| This month | *-1mo | * |
Want to ask a follow-up?
PiChat can help with your specific PI System use case. Ask follow-up questions, get code examples, and troubleshoot issues.
Related Questions
Dive Deeper
More Questions
How do I configure PI AF templates?How do I authenticate with PI Web API from Python?What's the difference between snapshot and archive values in PI?What's the difference between PI Vision and PI ProcessBook?How do I build effective PI Vision displays?What are PI Event Frames and how do I use them?How do I write PI AF Analytics expressions?How do I use PI DataLink in Excel?Should I use PI Web API or AF SDK for my application?How do I write data to PI Data Archive?What are the main components of PI System architecture?How do I optimize PI Data Archive performance?How do I set up the PI Interface for OPC DA?How do I use PI Connector for UFL to import file data?How do I set up PI Data Archive high availability with collectives?What are the security best practices for PI System?How do I migrate PI Data Archive to a new server?How do I connect Power BI to PI System?How do I manage units of measure in PI System?What's the best way to learn PI System?What are good PI tag naming conventions?How do I access PI System data from Java or Linux?How do I set up PI AF notification rules?How do I use batch requests in PI Web API?How do I connect to PI AF Server using AF SDK in C#?How do I write VBA macros in PI ProcessBook?How does PI data compression work?How do I get real-time streaming updates from PI Web API?How do I troubleshoot PI AF Analysis errors?How do I write SQL queries against PI using PI OLEDB?What is PI interface buffering and how do I configure it?How do I search and query PI Event Frames?What is PI Integrator for Business Analytics?How do I fix the 'Point does not exist' error in PI System?What is the difference between PI ACE and AF Analytics?How do I manually enter data into PI Data Archive?What are AF hierarchy design best practices?What is a WebID in PI Web API and how does it work?How do I configure Kerberos authentication for PI System?Can I deploy PI System in the cloud?How do I calculate summaries (average, total, min, max) in PI?What are PI digital states and how do I use them?How do I connect PI System data to Grafana?How do I backup and restore PI Data Archive?How do I create custom symbols in PI Vision?How do I automate PI System tasks with PowerShell?What is AVEVA Connect and how does it relate to PI System?How do I check and handle data quality in PI System?How do I handle pagination in PI Web API responses?How does AVEVA PI System licensing work?How do I plan a PI System upgrade?