COLLAPSE ALL
  • Home
  • About Pixie
    • Pixie Overview
    • Data Sources
    • How Pixie uses eBPF
    • Roadmap
    • FAQ
    • Troubleshooting
  • Installing Pixie
    • Requirements
  • Using Pixie
    • Using the Live UI
    • Using the CLI
    • Using the API
  • Tutorials
  • Reference
    • Architecture
    • PxL
      • Compile Time Functions
        • px.days
        • px.equals_any
        • px.format_duration
        • px.hours
        • px.make_upid
        • px.microseconds
        • px.milliseconds
        • px.minutes
        • px.now
        • px.parse_duration
        • px.parse_time
        • px.script_reference
        • px.seconds
        • px.strptime
        • px.uint128

px.parse_time

Parse the various time formats into a unified format.

This function can unify all possible time formats into a single consistent type. Useful for doing calculations on these values in a way that is agnostic to their format.

Arguments

NameTypeDescription
timestring, int, timeThe time as a string, int, or px.Time.

Returns

px.Time: The unix timestamp in nanoseconds.

Examples

## As a relative time string.
# time = now -300000000000
time = px.parse_time("-5m")
# time = now + 300000000000
time = px.parse_time("5m")
# Takes in px.Time
time = px.parse_time(px.strptime("2020-03-12 19:39:59 -0200", "%Y-%m-%d %H:%M:%S %z"))
# Takes in int
time = px.parse_time(10)

This site uses cookies to provide you with a better user experience. By using Pixie, you consent to our use of cookies.