All Apps and Add-ons

How convert a time field from %Y%m%d%H%M%S.0Z to a human readable format?

darlas
Communicator

After upgrading Active Directory Add-on to pull ldap data, the date fields are coming in a strange format which I cannot figure out how to convert.

The format is %Y%m%d%H%M%S.0Z

For example: 20140402220534.0Z

I assume the .0Z part is a timezone reference.

Anyhow, I'm trying to convert/display it in a human readable way, but cannot figure it out.

Any ideas?

0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi darlas,

probably there is a better way to do this, but if you take your date string and strptime first and strftime after you get something like this 2014-04-02 22:05:34. Here is the search to get there (the first line is only to create the date string):

| gentimes start=-1 | eval myTime="20140402220534" 
| eval HumanTime=strptime(myTime, "%Y%m%d%H%M%S") 
| eval HumanTime2=strftime(HumanTime, "%Y-%m-%d %H:%M:%S") 
| table myTime HumanTime HumanTime2

BTW the .0Z means UTC.

Hope this helps ...

cheers, MuS

View solution in original post

MuS
SplunkTrust
SplunkTrust

Hi darlas,

probably there is a better way to do this, but if you take your date string and strptime first and strftime after you get something like this 2014-04-02 22:05:34. Here is the search to get there (the first line is only to create the date string):

| gentimes start=-1 | eval myTime="20140402220534" 
| eval HumanTime=strptime(myTime, "%Y%m%d%H%M%S") 
| eval HumanTime2=strftime(HumanTime, "%Y-%m-%d %H:%M:%S") 
| table myTime HumanTime HumanTime2

BTW the .0Z means UTC.

Hope this helps ...

cheers, MuS

darlas
Communicator

You are my HERO !

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...