Splunk Search

How to to update hour of a timestamp variable?

mxh7777
Path Finder

Hi,

I'm looking for a way to change the hour of a time variable

Exemple :

myTime="2022-11-20 05:23:42"

and I want myTime to be equal "2022-11-20 08:00:00"

How can I proceed please ?


Thanks

Labels (2)
0 Karma

mxh7777
Path Finder

OK,

I think i get it.

This works

| eval myTime=strptime(strftime(strptime(myTime,"%Y-%m-%d %H:%M:%S") ,"%Y-%m-%d 08:%M:%S") ,"%Y-%m-%d %H:%M:%S")

but maybe there is a better way

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

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 ...