Splunk Search

Convert Date to Day of Week

Splunkster45
Communicator

I have a Field that contains values in the YYYY-MM-DD. What's the best way to convert it to the day of week? For example if I had a field called ODATE=2015-01-27 then I'd want a field called ODAY_OF_WEEK=Tuesday.

Note- The 'timestamp' ODATE is not the actual timestamp for the log and so I can't use _time.

I've tried to used mktime and strftime, but I haven't figured it out, yet.

Thanks in advance!

Tags (2)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

This should do it:

... | eval ODAY_OF_WEEK = strftime(strptime(ODATE, "%Y-%m-%d"), "%A")

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

This should do it:

... | eval ODAY_OF_WEEK = strftime(strptime(ODATE, "%Y-%m-%d"), "%A")
Get Updates on the Splunk Community!

Index This | What did the zero say to the eight?

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

Splunk Observability Cloud's AI Assistant in Action Series: Onboarding New Hires & ...

This is the fifth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Now Playing: Splunk Education Summer Learning Premieres

It’s premiere season, and Splunk Education is rolling out new releases you won’t want to miss. Whether you’re ...