Getting Data In

Timezone

Khuzair81
Path Finder

How to convert the below the time field from GMT to EST. 

time=Jun 7, 2021 10:24:33 AM GMT

i tried below

| eval t=strftime(strptime(time, "%m %d, %y %H:%M:%S %Z"), "%H:%M:%S")

I'm not getting the result

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The strptime format string doesn't match the sample time string.  Try this

| eval t=strftime(strptime(time, "%b %d, %y %H:%M:%S %p %Z"), "%H:%M:%S")

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

Khuzair81
Path Finder

@richgalloway i want to get the data only from yesterday is there anyway to write it in Query

Can i use  | where Date=-1d@d

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This should be a new posting, but, yes, you can do that, however not using where.  To search only yesterday, use the earliest and latest options to the search command.

index=foo earliest=-1d@d latest=@d

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The strptime format string doesn't match the sample time string.  Try this

| eval t=strftime(strptime(time, "%b %d, %y %H:%M:%S %p %Z"), "%H:%M:%S")

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...