Dashboards & Visualizations

Working with strange time & date values (Convert 20190325 into 2019:03:25)

x213217
Explorer

Hello,
I need help with working with some odd styles of time and date values that i am trying to format

TransferStartTime = 000036
This means at the 00 hr 00 min 36 second

TransferStartDate = 20190325
This means at 2019 year 03 month 25 day

So in essence it is basically one clumped value for each time and the date
Since this is not epoch,
how can i separate the StartTime to display as 00:00:36 and the TransferStartDate as 2019:03:25 ? So it is a lot more clear

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

@x213217 ,

|eval TransferStartDate =strftime(strptime(TransferStartDate,"%Y%m%d"),"%Y:%m:%d")
|eval TransferStartTime =strftime(strptime(TransferStartTime ,"%H%M%S"),"%H:%M:%S")

Combined date & time

 |eval TransferDateTime=TransferStartDate." ".TransferStartTime
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

vnravikumar
Champion

Hi

Try like

| makeresults 
| eval TransferStartTime ="000036" 
| rex field=TransferStartTime "(?P<Hr>\d\d)(?P<Min>\d\d)(?P<Sec>\d\d)" 
| eval TransferStartTime = Hr.":".Min.":".Sec 
| eval TransferStartDate ="20190325" 
| rex field=TransferStartDate "(?P<year>\d\d\d\d)(?P<Mon>\d\d)(?P<day>\d\d)" 
| eval TransferStartDate= year.":".Mon.":".day 
| table TransferStartTime TransferStartDate
0 Karma

renjith_nair
Legend

@x213217 ,

|eval TransferStartDate =strftime(strptime(TransferStartDate,"%Y%m%d"),"%Y:%m:%d")
|eval TransferStartTime =strftime(strptime(TransferStartTime ,"%H%M%S"),"%H:%M:%S")

Combined date & time

 |eval TransferDateTime=TransferStartDate." ".TransferStartTime
---
What goes around comes around. If it helps, hit it with Karma 🙂

x213217
Explorer

Thank you!

0 Karma
Get Updates on the Splunk Community!

2024 Splunk Career Impact Survey | Earn a $20 gift card for participating!

Hear ye, hear ye! The time has come again for Splunk's annual Career Impact Survey!  We need your help by ...

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...

What's New in Splunk Cloud Platform 9.2.2403?

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