Splunk Search

Any use cases on time commands in splunk SPL....?

prakash007
Builder

Can anyone explain the time commands in Splunk with a use case? I see few of these searches in Splunk Answers, but I understood only bits and pieces of them when used in searches...

_time
time()
now()
relative_time()
info_min_time()
info_max_time()
strptime()
strftime()
Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

You've mixed functions and fields.

_time is a field that says when an event happened.
info_min_time and info_max_time are fields added by the addinfo command. These fields are the lower and upper bounds of the search. They can be used to define the time period of a report, for instance.

The now() and time() functions both return the current time of day. time() includes microseconds whereas now() is the time in seconds. Both can be used in calculations to determine how old an event is.
The strptime() function converts a timestamp string ("2016-06-05", for example) into epoch (integer) form. This is the only way to do calculations with times.
The strftime() function is the inverse of strptime(). It converts a timestamp from epoch form into a human-readable string.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

You've mixed functions and fields.

_time is a field that says when an event happened.
info_min_time and info_max_time are fields added by the addinfo command. These fields are the lower and upper bounds of the search. They can be used to define the time period of a report, for instance.

The now() and time() functions both return the current time of day. time() includes microseconds whereas now() is the time in seconds. Both can be used in calculations to determine how old an event is.
The strptime() function converts a timestamp string ("2016-06-05", for example) into epoch (integer) form. This is the only way to do calculations with times.
The strftime() function is the inverse of strptime(). It converts a timestamp from epoch form into a human-readable string.

---
If this reply helps you, Karma would be appreciated.
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...