Dashboards & Visualizations

data

Siddharthnegi
Contributor

hello I have a date 2024-06 how can i convert it to 06/2024?
and 2023/Q4 to  Q4/2023

0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

Is that a field in Splunk that is a string. 

You can do this by swapping the characters around - for your first example

 

| eval date=replace(date, "(\d{4})-(\d{2})", "\2-\1")

 

and your second

 

| eval date=replace(date, "(\d{4})\/Q(\d)", "Q\2/\1")

 

where your data field is called date

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

Is that a field in Splunk that is a string. 

You can do this by swapping the characters around - for your first example

 

| eval date=replace(date, "(\d{4})-(\d{2})", "\2-\1")

 

and your second

 

| eval date=replace(date, "(\d{4})\/Q(\d)", "Q\2/\1")

 

where your data field is called date

Get Updates on the Splunk Community!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...