<?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: Convert Time format in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Convert-Time-format/m-p/328323#M40528</link>
    <description>&lt;P&gt;@goyals05, I hope the above example is timestamp is String Time and not Epoch Time.&lt;BR /&gt;
You can convert String Time in your old format to Epoch Time in new format using strptime() and then convert to string time of your new format using strftime()&lt;/P&gt;

&lt;P&gt;In order to understand the conversion you can try the following run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval myTimeOld="2017-10-26T16:59:29.565+0200"
|  eval myTimeNewEpoch=strptime(myTimeOld,"%Y-%m-%dT%H:%M:%S")
|  eval myTimeNew=strftime(myTimeNewEpoch,"%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can cascade this conversion in a single eval like the following as well:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval myTimeOld="2017-10-26T16:59:29.565+0200"
|  eval myTimeNew=strftime(strptime(myTimeOld,"%Y-%m-%dT%H:%M:%S"),"%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Oct 2017 14:31:29 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-10-27T14:31:29Z</dc:date>
    <item>
      <title>Convert Time format</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Convert-Time-format/m-p/328322#M40527</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am getting time stamp as  "2017-10-26T16:59:29.565+0200". How can I convert it in "2017-10-26 16:59:29" format.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 12:54:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Convert-Time-format/m-p/328322#M40527</guid>
      <dc:creator>goyals05</dc:creator>
      <dc:date>2017-10-27T12:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Time format</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Convert-Time-format/m-p/328323#M40528</link>
      <description>&lt;P&gt;@goyals05, I hope the above example is timestamp is String Time and not Epoch Time.&lt;BR /&gt;
You can convert String Time in your old format to Epoch Time in new format using strptime() and then convert to string time of your new format using strftime()&lt;/P&gt;

&lt;P&gt;In order to understand the conversion you can try the following run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval myTimeOld="2017-10-26T16:59:29.565+0200"
|  eval myTimeNewEpoch=strptime(myTimeOld,"%Y-%m-%dT%H:%M:%S")
|  eval myTimeNew=strftime(myTimeNewEpoch,"%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can cascade this conversion in a single eval like the following as well:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval myTimeOld="2017-10-26T16:59:29.565+0200"
|  eval myTimeNew=strftime(strptime(myTimeOld,"%Y-%m-%dT%H:%M:%S"),"%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 14:31:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Convert-Time-format/m-p/328323#M40528</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-27T14:31:29Z</dc:date>
    </item>
  </channel>
</rss>

