Getting Data In

How can I convert time 2016-09-12T10:16:51.000+00:00 with timezone specified in simple date and time (2016-09-12 10:16:51)format

isha_rastogi
Path Finder

I've been trying to convert "2016-09-12T10:16:51.000+00:00" into simple format i.e:
2016-09-12 10:16:51.
Tried using strptime and strftime
mysearch|eval _time=strptime(_time,"%Y-%m-%d%Z%T%c")| eval _time=strftime(_time,"%Y-%m-%d %H:%M") | timechart count
Any help will be appreciated.

0 Karma
1 Solution

sundareshr
Legend

Try this runanywhere sample.

| makeresults | eval x="2016-09-12T10:16:51.000+05:00" | eval y=strptime(x, "%Y-%m-%dT%H:%M:%S.%3N%z") | eval z=strftime(y, "%Y-%m-%d %H:%M:%S") | table x y z

View solution in original post

0 Karma

sundareshr
Legend

Try this runanywhere sample.

| makeresults | eval x="2016-09-12T10:16:51.000+05:00" | eval y=strptime(x, "%Y-%m-%dT%H:%M:%S.%3N%z") | eval z=strftime(y, "%Y-%m-%d %H:%M:%S") | table x y z
0 Karma

isha_rastogi
Path Finder

It Worked. Thanks 🙂

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...