Splunk Search

Time format conversion

narabhut
Explorer

I need to convert _time (in this format: 12/1/12 12:00:00.000 AM) to milliseconds since 1970 (unix time). I'm using convert timeformat="%s" ctime(_time) AS timeInUTC but that seems to return the wrong results...

For example, 12/1/12 12:00:00.000 AM ----> 1354341600 (Fri Jan 16 1970 10:12:21 GMT-0600 (CST))

Tags (4)
0 Karma

grijhwani
Motivator

Unix epoc time is seconds since 1970-01-01, not milliseconds.

I don't know where you are getting your calculation from, because the number is correct:

raj@huey[pts/1 2013-07-22 23:24:00]:~$ date -d "1 jan 1970 1354341600 seconds"
Sat Dec  1 05:00:00 GMT 2012
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...