Getting Data In

convert time format

avi123
Explorer

Hi All, 

I have a splunk query returning output as:

STime

09:45

 

I want to convert it to hours. Expected output:

STime

9.75 hrs

 

How do I achieve this using splunk

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

This run-anywhere example should explain the process.

| makeresults 
| eval STime="9:45"
| rex field=STime "(?<hrs>\d+):(?<mins>\d+)"
| eval Hours=hrs + round(mins/60,2)
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In January, the Splunk Threat Research Team had one release of new security content via the Splunk ES Content ...

Expert Tips from Splunk Professional Services, Ensuring Compliance, and More New ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Observability Release Update: AI Assistant, AppD + Observability Cloud Integrations & ...

This month’s releases across the Splunk Observability portfolio deliver earlier detection and faster ...