Splunk Search

Can you help me convert a timestamp to another timestamp?

ElBorni96
Engager

Hi all,

I need to convert this timestamp

2019-03-13T00:35:10+0100

to this

13-03-2019 00:35:10

How can I do this?

0 Karma
1 Solution

adonio
Ultra Champion

try this everywhere:

| makeresults count=1
| eval time = "2019-03-13T00:35:10+0100"
| eval time_epoch = strptime(time, "%Y-%m-%dT%H:%M:%S")
| eval desired_time_format = strftime(time_epoch, "%d-%m-%Y %H:%M:%S")

hope it helps

View solution in original post

0 Karma

adonio
Ultra Champion

try this everywhere:

| makeresults count=1
| eval time = "2019-03-13T00:35:10+0100"
| eval time_epoch = strptime(time, "%Y-%m-%dT%H:%M:%S")
| eval desired_time_format = strftime(time_epoch, "%d-%m-%Y %H:%M:%S")

hope it helps

0 Karma

ElBorni96
Engager

Thanks @adonio,

I solved using

| eval Last_Event_Time = strptime(Last_Event_Time, "%Y-%m-%dT%H:%M:%S") 
| eval Last_Event_Time = strftime(Last_Event_Time, "%d-%m-%Y %H:%M:%S")

Best Regards

0 Karma

adonio
Ultra Champion

@ElBorni96
kindly accept the answer so others will know it works for you

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...