Splunk Search

Issue trying to use ctime

msarro
Builder

Hey everyone, I am trying to convert two different date fields into unix time to do some mathematical operations. One of my timestamps doesn't want to convert for some reason. Here it is:
20110527162327.013

The time format is YYYYMMDDHHmmss.sss.

I pass it into convert like so:

convert timeformat="%Y%m%d%H%M%S.%q" mktime(AS_Start_Time) 

But it still outputs the exact same input time. Anyone have any ideas?

Tags (1)
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

I suppose it's a bug, but convert...mktime() is probably deprecated at this point in favor of eval...strptime():

eval AS_Start_Time=strptime(AS_Start_Time,"%Y%m%d%H%M%S.%q")

msarro
Builder

The documentation for version 4.2.1 does not show convert as deprecated. Just curious if you're going by best practices or is the function in fact deprecated and the documentation doesn't reflect that?

0 Karma
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...