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 (1)
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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...