Getting Data In

How to convert time format?

ravicheepa
Engager

I have time in Variable End_Time = 23:06 and want to convert this to 2306. How can I do that? I tried Strptime(End_Time, %z) but it is not working.

Tags (2)
0 Karma
1 Solution

adonio
Ultra Champion

hello there,

what is the use case in converting 23:06 to 2306?
in any case, run this anywhere and apply:

| makeresults count=1 
| eval times = "23:54, 12:35, 14:32, 8:12"
| makemv delim="," times
| mvexpand times
| eval new_time = replace(times,":","")

hope it helps

View solution in original post

adonio
Ultra Champion

hello there,

what is the use case in converting 23:06 to 2306?
in any case, run this anywhere and apply:

| makeresults count=1 
| eval times = "23:54, 12:35, 14:32, 8:12"
| makemv delim="," times
| mvexpand times
| eval new_time = replace(times,":","")

hope it helps

ravicheepa
Engager

Thanks Adonio, it helped. One more thing I am trying to do i.e. Displaying execution time using Single value chart but as there are : in time format it displays the time but not able to do formatting like color change as because of : there colour ranges do not work same with trend line.

Is there any way to display time in Single value graph as HH:MM:SS along with color and trends option ?

0 Karma

adonio
Ultra Champion

can you please elaborate?
not sure i understand what is the anticipated result

0 Karma

ravicheepa
Engager

I want use Single value chart to display time in HH:MM:SS format and also want to change color on range of time for example time is in between 06:30:00 to 7:30:00 then red color etc.. and want to show past trends as well.

So is there any way I can make this happen ? I tried passing values in format HH:MM:SS but it seems like single value graph work proper with numeric values only. Because of : in value it is not behaving proper.

So just need to know if there any way ?

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...