Splunk Search

Problem with strptime() when date is earlier than 1970

manus
Communicator

|eval DateMeasured="1900-01-01"

|eval DateMeasured=strftime(strptime(DateMeasured,"%Y-%m-%d"),"%d/%m/%Y")

Returns nothing. And I think it's because the date is before 1rst jan 1970.

Does somebody know how to make this work?

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try this workaround.

|eval DateMeasured="1900-01-01" | eval DateMeasured=replace(DateMeasured,"^(\d{4})-(\d{1,2})-(\d{1,2})", "\3/\2/\1") 

View solution in original post

somesoni2
Revered Legend

Try this workaround.

|eval DateMeasured="1900-01-01" | eval DateMeasured=replace(DateMeasured,"^(\d{4})-(\d{1,2})-(\d{1,2})", "\3/\2/\1") 

manus
Communicator

Yes, that works!

0 Karma

manus
Communicator

As my question implied, I wanted to re-format it.
Thank you very much for the quick answer.

0 Karma

somesoni2
Revered Legend

Splunk only support date with epoch value greater than 0 (which is 01 Jan 1970 00:00:00 UTC). What do you intend to do with dates older than 1970?

Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...