Splunk Search

Add a number of hours to a search field?

balcv
Contributor

I have a field returned with some search data that contains a date and time in UTC.  I would like to be able to add 10 hours to the time.

a) Field contents(dateTime UTC):  2023-05-08T00:24:37.6079338Z

b) New field (Local dateTime):         2023-05-08 10:24:37.607

Is there a way to do the conversion from a) to b) in the search syntax?

Labels (1)
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @balcv,

You can use below;

| eval newtime=strftime(strptime(datefield,"%Y-%m-%dT%H:%M:%S.%7QZ")+36000,"%Y-%m-%dT%H:%M:%S.%3QZ")
If this reply helps you an upvote and "Accept as Solution" is appreciated.

balcv
Contributor

Perfect thanks @scelikok 

0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...