<?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: Date and Time fields from the string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673522#M230627</link>
    <description>&lt;P&gt;Hello and thank you everyone for the help.&lt;BR /&gt;&lt;BR /&gt;What i try to get out the existing data (&lt;SPAN&gt;2024-01-08T04:53:13.028149Z)&lt;/SPAN&gt; :&lt;BR /&gt;UdateDate - YYYY-MM-DD i.e.&amp;nbsp;2021-08-02&lt;BR /&gt;UpdateTime - HH:MM i.e.&amp;nbsp;13:36&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jan 2024 12:42:17 GMT</pubDate>
    <dc:creator>bigll</dc:creator>
    <dc:date>2024-01-08T12:42:17Z</dc:date>
    <item>
      <title>Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673138#M230509</link>
      <description>&lt;P&gt;I have a "myfiled" for the last update in format&amp;nbsp;&lt;SPAN&gt;2020-11-25T11:40:42.001198Z.&lt;BR /&gt;&lt;/SPAN&gt;I want to create two new fields UpdateDate and UpdateTime&lt;BR /&gt;&lt;BR /&gt;I used "eval" + "substr"&amp;nbsp;&lt;BR /&gt;--------&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval UpdateDate=substr("myfield",1,10)
| eval UpdateTime=substr("myfield",12,10)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;--------&lt;BR /&gt;But in the table&amp;nbsp; UpdateDate and UpdateTime are empty. while "myfield" has value as shown above.&lt;BR /&gt;&lt;BR /&gt;Any suggestions?&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 16:59:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673138#M230509</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-01-03T16:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673146#M230511</link>
      <description>&lt;P&gt;Removing the double quotes from around the myfield in the substr() function I think should fix it.&lt;BR /&gt;The substr() is acting on the "myfield" as a literal string instead of a placeholder for a field value.&lt;BR /&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
    | eval
        myfield="2020-11-25T11:40:42.001198Z"
    | eval
        UpdateDate=substr(myfield,1,10),
        UpdateTime=substr(myfield,12,10)&lt;/LI-CODE&gt;&lt;P&gt;Screenshot:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_0-1704298494457.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28740i49B96B6A656F3C7B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_0-1704298494457.png" alt="dtburrows3_0-1704298494457.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 16:15:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673146#M230511</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-03T16:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673158#M230514</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235910"&gt;@bigll&lt;/a&gt;&amp;nbsp;- I would use strptime() and strftime() for any changes with Date and/or Time Format.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval myfield="2020-11-25T11:40:42.001198Z"
| eval myfieldepoch=strptime(myfield,"%Y-%m-%dT%H:%M:%S.%6NZ")
| eval UpdateDate=strftime(myfieldepoch,"%Y-%m-%d")
| eval UpdateTime=strftime(myfieldepoch,"%H:%M:%S.%1N")
| table _time myfield myfieldepoch UpdateDate UpdateTime&lt;/LI-CODE&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="madhav_dholakia_0-1704301031911.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28744iFBF818977CF69CA6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="madhav_dholakia_0-1704301031911.png" alt="madhav_dholakia_0-1704301031911.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jan 2024 17:01:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673158#M230514</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2024-01-03T17:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673242#M230538</link>
      <description>&lt;P class="lia-align-left"&gt;Thank you for an update.&lt;BR /&gt;Looks like I am missing something.&lt;BR /&gt;Eval statements do not produce the results&lt;BR /&gt;My SPL statement&lt;/P&gt;&lt;P class="lia-align-left"&gt;--Query------&lt;BR /&gt;Index=xyz&amp;nbsp;&lt;BR /&gt;| eval evTime=strptime(agent.status.policy_refresh_at,"%Y-%m-%dT%H:%M:%S.%6NZ")&lt;BR /&gt;| eval UpdateDate=strftime(evTime,"%Y-%m-%d")&lt;BR /&gt;| eval UpdateTime=strftime(evTime,"%H:%M:%S.%1N")&lt;BR /&gt;| table agent.status.policy_refresh_at, evTime, UpdateDate, UpdateTime, hostname&lt;BR /&gt;-----------------&lt;/P&gt;&lt;P&gt;agent.status.policy_refresh_at evTime UpdateDate UpdateTime &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;hostname&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="248.375px" height="24px"&gt;2024-01-04T10:31:35.529752Z&lt;/TD&gt;&lt;TD width="45.3125px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="73.4375px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="74.8542px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="202.219px" height="24px"&gt;CN*******&lt;/TD&gt;&lt;TD width="248.375px" height="24px"&gt;2024-01-04T10:31:51.654448Z&lt;/TD&gt;&lt;TD width="45.3125px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="73.4375px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="74.8542px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="202.219px" height="24px"&gt;CN*******&lt;/TD&gt;&lt;TD width="248.375px" height="24px"&gt;2023-11-26T05:57:47.775675Z&lt;/TD&gt;&lt;TD width="45.3125px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="73.4375px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="74.8542px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="202.219px" height="24px"&gt;gb********&lt;/TD&gt;&lt;TD width="248.375px" height="24px"&gt;2024-01-04T10:32:14.416359Z&lt;/TD&gt;&lt;TD width="45.3125px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="73.4375px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="74.8542px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="202.219px" height="24px"&gt;cn********&lt;/TD&gt;&lt;TD width="248.375px" height="24px"&gt;2024-01-04T10:30:32.998086Z&lt;/TD&gt;&lt;TD width="45.3125px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="73.4375px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="74.8542px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="202.219px" height="24px"&gt;cn*******&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 04 Jan 2024 16:19:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673242#M230538</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-01-04T16:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673245#M230539</link>
      <description>&lt;P&gt;Table format get changed&lt;BR /&gt;Please see picture instead&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bigll_0-1704385257164.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28759i80BE9B52F204EFEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bigll_0-1704385257164.png" alt="bigll_0-1704385257164.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 16:21:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673245#M230539</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-01-04T16:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673253#M230541</link>
      <description>&lt;P&gt;If a fieldname has special characters in it, i.e. (".", "{", "}", ...) Then it may require to be wrapped in single quotes when used in an eval function.&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=xyz
    | eval
        evTime=strptime('agent.status.policy_refresh_at',"%Y-%m-%dT%H:%M:%S.%6NZ"),
        UpdateDate=strftime(evTime,"%Y-%m-%d"),
        UpdateTime=strftime(evTime,"%H:%M:%S.%1N")
    | table agent.status.policy_refresh_at, evTime, UpdateDate, UpdateTime, hostname&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output with sim data on my local instance.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_0-1704388293730.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28762i19F356D733685D84/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_0-1704388293730.png" alt="dtburrows3_0-1704388293730.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 17:12:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673253#M230541</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2024-01-04T17:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673291#M230548</link>
      <description>&lt;P&gt;To ask a good question, you really want to tell people what is the desired output. &amp;nbsp;Illustrate with a table (anonymize as needed), not just code, not a screenshot with output that you think is wrong. (Screenshots are usually less useful anyway.)&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%"&gt;&lt;SPAN&gt;agent.status.policy_refresh_at&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="25%"&gt;&lt;SPAN&gt;UpdateDate&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="25%"&gt;&lt;SPAN&gt;UpdateTime&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="25%"&gt;host&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;2024-01-04T10:31:35.529752Z&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;??&lt;/TD&gt;&lt;TD&gt;???&lt;/TD&gt;&lt;TD&gt;blah&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Without your actual description, volunteers can speculate UpdateDate&lt;SPAN&gt;&amp;nbsp;(per customary denotation) as&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;2024-01-04. &amp;nbsp;But what about UpdateTime? &amp;nbsp;Do you want&amp;nbsp;10:31:35.529752Z? &amp;nbsp;Do you want&amp;nbsp;10:31:35.529752? &amp;nbsp;Do you want&amp;nbsp;10:31:35.5 as your initial code would have suggested? (Why truncate to 10 characters? &amp;nbsp;Is there a desired precision?)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You also want to let people know your intention with UpdateData and UpdateTime. &amp;nbsp;Are these for display only? &amp;nbsp;Do you intend to perform numerical comparison &lt;STRONG&gt;after&lt;/STRONG&gt; this table is established? &amp;nbsp;If not, there is no benefit to convert&amp;nbsp;agent.status.policy_refresh_at to epoch value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you want UpdateTime to include time zone (the trailing "Z" is a valid timezone, not an idle letter), this should suffice&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = xyz
| eval agent.status.policy_refresh_at = split('agent.status.policy_refresh_at', "T")
| eval UpdateDate = mvindex('agent.status.policy_refresh_at', 0)
| eval UpdateTime = mvindex('agent.status.policy_refresh_at', 1)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your sample data will give&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;UpdateDate&lt;/TD&gt;&lt;TD&gt;UpdateTime&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;agent.status.policy_refresh_at&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;host&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2024-01-04&lt;/TD&gt;&lt;TD&gt;10:31:35.529752Z&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2024-01-04&lt;/DIV&gt;&lt;DIV class=""&gt;10:31:35.529752Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;CN****&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2024-01-04&lt;/TD&gt;&lt;TD&gt;10:31:51.654448Z&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2024-01-04&lt;/DIV&gt;&lt;DIV class=""&gt;10:31:51.654448Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;CN****&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2023-11-26&lt;/TD&gt;&lt;TD&gt;05:57:47.775675Z&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2023-11-26&lt;/DIV&gt;&lt;DIV class=""&gt;05:57:47.775675Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;gb****&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2024-01-04&lt;/TD&gt;&lt;TD&gt;10:32:14.416359Z&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2024-01-04&lt;/DIV&gt;&lt;DIV class=""&gt;10:32:14.416359Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;cn****&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2024-01-04&lt;/TD&gt;&lt;TD&gt;10:30:32.998086Z&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2024-01-04&lt;/DIV&gt;&lt;DIV class=""&gt;10:30:32.998086Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;cn****&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;If you do not wish timezone to be included (not sure why that is desirable), you can strip it, like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = xyz
| eval agent.status.policy_refresh_at = split('agent.status.policy_refresh_at', "T")
| eval UpdateDate = mvindex('agent.status.policy_refresh_at', 0)
| eval UpdateTime = replace(mvindex('agent.status.policy_refresh_at', 1), "\D$", "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to control precision, you can also limit number of decimals, etc.&lt;/P&gt;&lt;P&gt;Here is an emulation you can play with and compare with real data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="agent.status.policy_refresh_at,host
2024-01-04T10:31:35.529752Z,CN****
2024-01-04T10:31:51.654448Z,CN****
2023-11-26T05:57:47.775675Z,gb****
2024-01-04T10:32:14.416359Z,cn****
2024-01-04T10:30:32.998086Z,cn****"
``` data emulation above, equivalent to
index = xyz
```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 23:57:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673291#M230548</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-01-04T23:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673369#M230567</link>
      <description>&lt;P&gt;Thank you for the reply.&lt;BR /&gt;&lt;BR /&gt;The end goal of the exercise is to build report for agents that are not updated in last 24 hours and mot updated in last 7 days.&lt;BR /&gt;That is why I try to extract last time of update and last date of update.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 14:41:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673369#M230567</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-01-05T14:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673427#M230600</link>
      <description>&lt;P&gt;Once again, let me ask:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Please draw a table to illustrate the output you desire. &amp;nbsp;Without it, volunteers are wasting time reading mind.&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;For agent.status.policy_refresh_at 2024-01-04T10:31:35.529752Z, should UpdateTime be 10:31:35.529752Z? &amp;nbsp;Do you want&amp;nbsp;10:31:35.529752? &amp;nbsp;Do you want&amp;nbsp;10:31:35.5 as your initial code would have suggested? &amp;nbsp;Or do you want something totally different?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Is the sample output I posted based on your mock data what you expect (save potential difference in format, precision, etc.)?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Do you intend to perform numerical comparison with UpdateTime/UpdateDate&amp;nbsp;&lt;STRONG&gt;after&lt;/STRONG&gt; this table is established?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;All these were asked in the previous post.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The "report" that you vaguely allude to (again, precise, specific requirement makes good question) suggests (fainly) to me that you will want some numeric calculation after separating UpdateTime from&amp;nbsp;agent.status.policy_refresh_at. (Question 4.) &amp;nbsp;If so, it also implies that you really need to preserve time zone and not lose precision. (Question 2.) &amp;nbsp;If my posted output is what you expect (Question 3), one way to achieve this is to apply strptime against this text UpdateTime&amp;nbsp;using a fixed date such as 1970-01-01. &amp;nbsp;However, Splunk is full of gems like &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Timewrap" target="_blank" rel="noopener"&gt;timewrap&lt;/A&gt;&amp;nbsp;which I only recently learned from this forum. &amp;nbsp;It may work a lot better for your use case, but the search will be rather different. &amp;nbsp;It all depends on the exact output you desire.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The moral is: Ask questions that volunteers can meaningfully help. &amp;nbsp;A good question begins with accurate description/illustration of (anonymized or mock) input/data, precise illustration of desired output, and sufficient explanation of logic (how to do it on paper) between data and desired output.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jan 2024 04:08:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673427#M230600</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-01-06T04:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673522#M230627</link>
      <description>&lt;P&gt;Hello and thank you everyone for the help.&lt;BR /&gt;&lt;BR /&gt;What i try to get out the existing data (&lt;SPAN&gt;2024-01-08T04:53:13.028149Z)&lt;/SPAN&gt; :&lt;BR /&gt;UdateDate - YYYY-MM-DD i.e.&amp;nbsp;2021-08-02&lt;BR /&gt;UpdateTime - HH:MM i.e.&amp;nbsp;13:36&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2024 12:42:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673522#M230627</guid>
      <dc:creator>bigll</dc:creator>
      <dc:date>2024-01-08T12:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Date and Time fields from the string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673565#M230642</link>
      <description>&lt;P&gt;You answered questions about data format, i.e., Question 2, also Question 1 to some extent. (It would always be more useful for you to construct a mock results table than using words.) &amp;nbsp;You did not indicate any intention to use UpdateTime in any numeric comparison downstream, negating part of what you implied earlier. &amp;nbsp; I will assume that the answer to Question 4 is "no". &amp;nbsp;As to Question 3, your update implies a "yes". &amp;nbsp;The only change you want is precision. &amp;nbsp;And by specifying HH:MM without any other condition, I deduce that you trust that raw&amp;nbsp;agent.status.policy_refresh_at all bear the same timezone.&lt;/P&gt;&lt;P&gt;If the above is correct, you can use pure string manipulation to achieve what you wanted:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval agent.status.policy_refresh_at = split('agent.status.policy_refresh_at', "T") ``` separate date from time of day ```
| eval UpdateDate = mvindex('agent.status.policy_refresh_at', 0)
| eval UpdateTime = split(mvindex('agent.status.policy_refresh_at', 1), ":") ``` break time of day by colon ```
| eval UpdateTime = mvjoin(mvindex(UpdateTime, 0, 1), ":") ``` reconstruct with first two elements only ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the same emulation I constructed from your mock data, the output shoud be&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;UpdateDate&lt;/TD&gt;&lt;TD&gt;UpdateTime&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;agent.status.policy_refresh_at&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;host&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2024-01-04&lt;/TD&gt;&lt;TD&gt;10:31&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2024-01-04&lt;/DIV&gt;&lt;DIV class=""&gt;10:31:35.529752Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;CN****&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2024-01-04&lt;/TD&gt;&lt;TD&gt;10:31&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2024-01-04&lt;/DIV&gt;&lt;DIV class=""&gt;10:31:51.654448Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;CN****&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2023-11-26&lt;/TD&gt;&lt;TD&gt;05:57&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2023-11-26&lt;/DIV&gt;&lt;DIV class=""&gt;05:57:47.775675Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;gb****&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2024-01-04&lt;/TD&gt;&lt;TD&gt;10:32&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2024-01-04&lt;/DIV&gt;&lt;DIV class=""&gt;10:32:14.416359Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;cn****&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2024-01-04&lt;/TD&gt;&lt;TD&gt;10:30&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;2024-01-04&lt;/DIV&gt;&lt;DIV class=""&gt;10:30:32.998086Z&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;cn****&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2024 20:18:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-and-Time-fields-from-the-string/m-p/673565#M230642</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-01-08T20:18:29Z</dc:date>
    </item>
  </channel>
</rss>

