<?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 a field containing number of days since 01/01/1970 to a human readable date? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215196#M63073</link>
    <description>&lt;P&gt;Hi.&lt;/P&gt;

&lt;P&gt;I have a monitor of  "/etc/shadow" file with last password change field &lt;STRONG&gt;lastchange&lt;/STRONG&gt; in days (example lastchange=16937). It's a number of days from 01/01/1970&lt;BR /&gt;
I need to determine the date of last password change of a user.&lt;BR /&gt;
I want to do something like: &lt;CODE&gt;01.01.1970+lastchange=last_password_change_date&lt;/CODE&gt;&lt;BR /&gt;
How to do that?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jun 2016 10:53:23 GMT</pubDate>
    <dc:creator>kalianov</dc:creator>
    <dc:date>2016-06-21T10:53:23Z</dc:date>
    <item>
      <title>How to convert a field containing number of days since 01/01/1970 to a human readable date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215196#M63073</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;

&lt;P&gt;I have a monitor of  "/etc/shadow" file with last password change field &lt;STRONG&gt;lastchange&lt;/STRONG&gt; in days (example lastchange=16937). It's a number of days from 01/01/1970&lt;BR /&gt;
I need to determine the date of last password change of a user.&lt;BR /&gt;
I want to do something like: &lt;CODE&gt;01.01.1970+lastchange=last_password_change_date&lt;/CODE&gt;&lt;BR /&gt;
How to do that?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 10:53:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215196#M63073</guid>
      <dc:creator>kalianov</dc:creator>
      <dc:date>2016-06-21T10:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a field containing number of days since 01/01/1970 to a human readable date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215197#M63074</link>
      <description>&lt;P&gt;There are 86400 seconds per day.  "Epoch time" is seconds since 1/1/1970 GMT.  Therefore you want to multiply days since 1/1/1970 by 86400. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... eval epochTime=lastchange*86400 ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once you have epoch time you can use "convert ctime(epochTime)" to change to human readable dates like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval epochTime=lastchange*86400 | convert ctime(epochTime) |...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jun 2016 11:08:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215197#M63074</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-06-21T11:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a field containing number of days since 01/01/1970 to a human readable date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215198#M63075</link>
      <description>&lt;P&gt;Thanks a lot.  It's working&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 11:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215198#M63075</guid>
      <dc:creator>kalianov</dc:creator>
      <dc:date>2016-06-21T11:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a field containing number of days since 01/01/1970 to a human readable date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215199#M63076</link>
      <description>&lt;P&gt;Anytime!  Thanks for marking as your answer!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 11:34:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215199#M63076</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-06-21T11:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a field containing number of days since 01/01/1970 to a human readable date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215200#M63077</link>
      <description>&lt;P&gt;@jkat54 , could you please help me on this, I have filed which contains number of days, i,e. &lt;STRONG&gt;days=20098&lt;/STRONG&gt; i,e 2020 jan 1st onwards. 98 days means April 7th 2020 like that. i need to convert these numbers to date.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 05:28:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215200#M63077</guid>
      <dc:creator>james_n</dc:creator>
      <dc:date>2020-04-09T05:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert a field containing number of days since 01/01/1970 to a human readable date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215201#M63078</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval days=20098
| eval days_hr=strptime(days,"%y%j")
| eval check = strftime(days_hr,"%c")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;@james_n  try this.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2020 08:27:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-a-field-containing-number-of-days-since-01-01/m-p/215201#M63078</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-09T08:27:21Z</dc:date>
    </item>
  </channel>
</rss>

