Splunk Search

How to edit my search to convert a string to date format?

gasdrubadiss
New Member

hello!

i have this date: 20150225123000998
I want this format date :

25/02/2015 12:30:00  998 (not important)

my search doesn't work:

    index="marketing1" |eval tempo=strftime(TimestampConsenso1, "%Y/%m/%d %H:%M:%n") | table tempo, TimestampConsenso1

this is my result:

9999/12/31 23:59:

help me?
thx

Tags (4)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Your format string doesn't match your example data. Try this.

index="marketing1" |eval tempo=strftime(strptime(TimestampConsenso1, "%Y%m%d%H%M%S%3S"), "%d/%m/%Y $H:%M:%S  %3N") | table tempo, TimestampConsenso1
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...