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!

Exporting Splunk Apps

Join us on Monday, October 21 at 11 am PT | 2 pm ET!With the app export functionality, app developers and ...

Cisco Use Cases, ITSI Best Practices, and More New Articles from Splunk Lantern

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

Build Your First SPL2 App!

Watch the recording now!.Do you want to SPL™, too? SPL2, Splunk's next-generation data search and preparation ...