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

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!

Splunk Observability Synthetic Monitoring - Resolved Incident on Detector Alerts

We’ve discovered a bug that affected the auto-clear of Synthetic Detectors in the Splunk Synthetic Monitoring ...

Video | Tom’s Smartness Journey Continues

Remember Splunk Community member Tom Kopchak? If you caught the first episode of our Smartness interview ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud? Learn how unique features like ...