<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Eval to find current time in another timezone in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161198#M32666</link>
    <description>&lt;P&gt;Hi MuS&lt;BR /&gt;
great search, it inspired me to look a little closer and do it even more general (i wondered first why you eval´ed AKDT and CEST), with only one timeformat string &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval foo=relative_time(now(), "-90m@s" ) | eval boo=relative_time(now(), "+21m@s" ) | eval now=now() | convert timeformat="%d.%m.%y %H:%M:%S" ctime(now), ctime(foo), ctime(boo) | t
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 13 May 2014 07:24:05 GMT</pubDate>
    <dc:creator>nekb1958</dc:creator>
    <dc:date>2014-05-13T07:24:05Z</dc:date>
    <item>
      <title>Eval to find current time in another timezone</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161195#M32663</link>
      <description>&lt;P&gt;I'm familiar with strftime and starptime command and timezones, but cant seem to manipulate now() and convert to a known timezone. As an example now() returns in PDT timezone and I would like to convert now() to CST6CDT. I tried using eval to do a diff but it doesnt return the field. Any idea why?&lt;/P&gt;

&lt;P&gt;| eval time_diff=strptime("CST6CDT", "%Z")&lt;/P&gt;</description>
      <pubDate>Mon, 12 May 2014 22:50:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161195#M32663</guid>
      <dc:creator>BP9906</dc:creator>
      <dc:date>2014-05-12T22:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Eval to find current time in another timezone</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161196#M32664</link>
      <description>&lt;P&gt;Might not be what you're looking for, but you can change the time zone your Splunk user is in to make Splunk display all times appropriately.&lt;/P&gt;</description>
      <pubDate>Mon, 12 May 2014 23:12:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161196#M32664</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-05-12T23:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Eval to find current time in another timezone</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161197#M32665</link>
      <description>&lt;P&gt;Hi BP9906,&lt;/P&gt;

&lt;P&gt;try this run everywhere command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval AKDT="-8h" | eval CEST="+2h" | eval foo=relative_time(now(), AKDT ) | eval boo=relative_time(now(), CEST ) | eval foo=strftime(foo, "%Y-%m-%d %H:%M:%S.%3N" ) | eval boo=strftime(boo, "%Y-%m-%d %H:%M:%S.%3N" ) | table foo boo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the times for &lt;CODE&gt;foo&lt;/CODE&gt; and &lt;CODE&gt;boo&lt;/CODE&gt; are in AKDT (Alaska Daylight Time) and CEST (Central European Summer Time). As you can see I had to &lt;CODE&gt;eval&lt;/CODE&gt; them first and then use them with &lt;CODE&gt;relative_time&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;To take this one step further, you could setup some automatic lookup containing all TZ and use them to do your time calculations.&lt;/P&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2014 06:02:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161197#M32665</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-05-13T06:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Eval to find current time in another timezone</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161198#M32666</link>
      <description>&lt;P&gt;Hi MuS&lt;BR /&gt;
great search, it inspired me to look a little closer and do it even more general (i wondered first why you eval´ed AKDT and CEST), with only one timeformat string &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval foo=relative_time(now(), "-90m@s" ) | eval boo=relative_time(now(), "+21m@s" ) | eval now=now() | convert timeformat="%d.%m.%y %H:%M:%S" ctime(now), ctime(foo), ctime(boo) | t
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 May 2014 07:24:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161198#M32666</guid>
      <dc:creator>nekb1958</dc:creator>
      <dc:date>2014-05-13T07:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Eval to find current time in another timezone</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161199#M32667</link>
      <description>&lt;P&gt;Thank you both for feedback. I also found another Splunk search that will convert the offset value (ie -0400) to relative time and then change it. This is almost what I'm looking for. The problem is that I have all our customer's timezones and I would like to create the alert based on their local business hours. So if the time is between these local business hours, send the alert.  The timezone codes are all the standardized notation that Splunk (python) supports but it seems like trying to convert the timezone code to epoch time doesnt work.&lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2014 14:33:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161199#M32667</guid>
      <dc:creator>BP9906</dc:creator>
      <dc:date>2014-05-13T14:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Eval to find current time in another timezone</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161200#M32668</link>
      <description>&lt;P&gt;Close but not quite: &lt;A href="http://answers.splunk.com/answers/4528/finding-your-local-timezone-with-eval"&gt;http://answers.splunk.com/answers/4528/finding-your-local-timezone-with-eval&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2014 14:34:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161200#M32668</guid>
      <dc:creator>BP9906</dc:creator>
      <dc:date>2014-05-13T14:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Eval to find current time in another timezone</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161201#M32669</link>
      <description>&lt;P&gt;I needed to get the current time in UTC timezone:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval utc_hourid=strftime(relative_time(now(),"+".(tonumber(strftime(now(),"%H"))-tonumber(strftime(strptime(strftime(now(),"%m/%d/%Y %H:%M:%S UTC"),"%m/%d/%Y %H:%M:%S %Z"),"%H")))."h"),"%m/%d/%Y %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can probably turn this eval exp to get current time in any timezone, just replace "UTC" with the timezone you want. This work with daylight savings time&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2017 15:29:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Eval-to-find-current-time-in-another-timezone/m-p/161201#M32669</guid>
      <dc:creator>arthurh</dc:creator>
      <dc:date>2017-04-16T15:29:28Z</dc:date>
    </item>
  </channel>
</rss>

