

You can use this function with the eval and where commands, in the WHERE clause of the from command, and as part of evaluation expressions with other commands. The strptime function takes any date from Januor later, and calculates the UNIX time, in seconds, from Januto the date you provide.
Part of the problem is that, in the comment chain, the parameters surrounding the initial question were changed by the asker. (Thanks to Splunk user cmerriman for this example.) mvtojsonarray(I've been told that the initial question has not been retroactively edited in any way which begs the question of what happened? I understand comments from a comment chain were likely converted to answers without the correct context, but still. They are most likely looking for "%Y-%m-%d %H:%M:%S" which is mentioned nowhere, or possibly "%F %T" as mentioned in the comments. What will the strftime function return when using the H argument Select all that apply. 99% of people who find this page are merely looking to convert epoch time to the default Splunk human-readable format, in which case what they are looking for is barely on this page. You can also use the statistical eval functions, such as max, on multivalue fields.See Statistical eval functions. A millisecond epoch time is providedĢ) The answer with 16 votes (?) fails to divide by 1000 OR provide the correct formatģ) The answer with 3 votes (?) fails to provide the correct comment of "%a,%d %b %Y %H:%M:%S"is correct, although technically you need to divide by 1000 if you are to use the millisecond epoch time that the post provides. The following list contains the functions that you can use on multivalue fields or to return multivalue fields. While that might seem odd, it makes addition/subtraction very easy.
#Splunk strftime how to
The format of the date that in the Opened column is as such: Any insight on how to write the SPL for this is greatly. Id like to minus TODAYs date from the 'Opened' field value and then display the difference in days. One of these dates falls within a field in my logs called, 'Opened'.

12:23:34 to epoch (which is the time expressed as the number of seconds since midnight Jan 1, 1970). Id like to obtain a difference between two dates. Considering converting from epoch is one of the most common Splunk questions of all time, considering this page has 46k views, and considering that each and every answer is entirely incorrect (and the actual question itself is misleading) this page is desperately in need of removal.ġ) The question doesn't actually provide a standard epoch time. One way would be to make use of the strptime()/strftime() functions of eval, which will let you convert time from strings, e.g.
