Splunk Search

Issue with strptime and strftime

deepak312
Explorer

I have a time input like below,

Mon Jul 13 09:30:00 PDT 2015

| eval human_readable_time= strftime(strptime(my_time, "%a %b %d %H:%M:%S %Z %Y"), "%m/%d/%y")

This doesn't return me anything. Not sure what is wrong. Any idea?
Second approach, I have tried is,

| eval human_readable_time= strftime(my_time, "%+")

marina_rovira
Contributor

HI there!

Have any of you two find a solution do this? I'm trying to get a time period for a call useing this:
eval final=(strptime(EndTime, "%a %b %d %H:%M:%S %Z%z %Y") | eval start=strptime(StartTime, "%a %b %d %H:%M:%S %Z%z %Y")

And then the rest between final-start, but I'm getting both fields empty. Any idea?

Thank you!

0 Karma

gcusello
SplunkTrust
SplunkTrust

I tried your transformation and the first one correctly works (the second one no).
could you share a log example?
I tried with the following search

index=* | head 1 | eval my_time="Mon Jul 13 09:30:00 PDT 2015" | eval human_readable_time=strftime(strptime(my_time,"%a %b %d %H:%M:%S %Z %Y"),"%m/%d/%y") | table _time human_readable_time

Bye.
Giuseppe

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

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 ...