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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...