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

Labels (1)
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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...