<?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 How to convert Day Mon Date HH:mm:ss UTC Year to YYYY-MM-DD HH:MM:SS:Q in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492773#M137435</link>
    <description>&lt;P&gt;Hi, I have a Timestamp field as &lt;STRONG&gt;Fri Nov 22 03:37:15 UTC 2019&lt;/STRONG&gt; and I want to convert into  &lt;STRONG&gt;YYYY-MM-DD HH:MM:SS:6Q&lt;/STRONG&gt;  format.&lt;/P&gt;

&lt;P&gt;Have tried using  &lt;CODE&gt;| eval InputTime=strftime(Timestamp,"%Y-%m-%d %H:%M:%S.%6Q")&lt;/CODE&gt; and it doesn't give me anything&lt;/P&gt;

&lt;P&gt;Could you please help?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2019 16:21:52 GMT</pubDate>
    <dc:creator>gravi</dc:creator>
    <dc:date>2019-11-22T16:21:52Z</dc:date>
    <item>
      <title>How to convert Day Mon Date HH:mm:ss UTC Year to YYYY-MM-DD HH:MM:SS:Q</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492773#M137435</link>
      <description>&lt;P&gt;Hi, I have a Timestamp field as &lt;STRONG&gt;Fri Nov 22 03:37:15 UTC 2019&lt;/STRONG&gt; and I want to convert into  &lt;STRONG&gt;YYYY-MM-DD HH:MM:SS:6Q&lt;/STRONG&gt;  format.&lt;/P&gt;

&lt;P&gt;Have tried using  &lt;CODE&gt;| eval InputTime=strftime(Timestamp,"%Y-%m-%d %H:%M:%S.%6Q")&lt;/CODE&gt; and it doesn't give me anything&lt;/P&gt;

&lt;P&gt;Could you please help?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 16:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492773#M137435</guid>
      <dc:creator>gravi</dc:creator>
      <dc:date>2019-11-22T16:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Day Mon Date HH:mm:ss UTC Year to YYYY-MM-DD HH:MM:SS:Q</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492774#M137436</link>
      <description>&lt;P&gt;You can try converting it to epoch first then converting it to your desired format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval time ="Fri Nov 22 03:37:15 UTC 2019"
| eval nix= strptime(time , "%a %b %d %H:%M:%S UTC %Y")
| eval newTime=strftime(nix, "%Y-%m-%d %H:%M:%S.%6Q")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2019 16:46:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492774#M137436</guid>
      <dc:creator>oscar84x</dc:creator>
      <dc:date>2019-11-22T16:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Day Mon Date HH:mm:ss UTC Year to YYYY-MM-DD HH:MM:SS:Q</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492775#M137437</link>
      <description>&lt;P&gt;Thanks you so much for the answer. I really appreciate it.&lt;/P&gt;

&lt;P&gt;And also do you know how to get the difference in datetime fields? Tried eval &lt;STRONG&gt;t=t1-t2&lt;/STRONG&gt; and it gives nothing&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 16:51:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492775#M137437</guid>
      <dc:creator>gravi</dc:creator>
      <dc:date>2019-11-22T16:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Day Mon Date HH:mm:ss UTC Year to YYYY-MM-DD HH:MM:SS:Q</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492776#M137438</link>
      <description>&lt;P&gt;No problem. Glad to help.&lt;BR /&gt;
For your other question look at the answer in the link below. Pretty much you'd need to convert your fields to epoch and calculate the difference from that. &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/114818/find-the-difference-between-two-date-time-values.html"&gt;https://answers.splunk.com/answers/114818/find-the-difference-between-two-date-time-values.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 17:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-Day-Mon-Date-HH-mm-ss-UTC-Year-to-YYYY-MM-DD-HH/m-p/492776#M137438</guid>
      <dc:creator>oscar84x</dc:creator>
      <dc:date>2019-11-22T17:05:06Z</dc:date>
    </item>
  </channel>
</rss>

