<?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: Issue to find the format to convert string to date in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485789#M83164</link>
    <description>&lt;P&gt;The issue came from field "Created Time" with space...I add the rename of my field without space and it works&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2020 12:31:56 GMT</pubDate>
    <dc:creator>erwanlebaron</dc:creator>
    <dc:date>2020-01-22T12:31:56Z</dc:date>
    <item>
      <title>Issue to find the format to convert string to date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485783#M83158</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I tried to convert some string to date but it doesn't work.&lt;/P&gt;

&lt;P&gt;Below an example of date ("Created Time")&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Created Time&lt;BR /&gt;
Friday April 19 2019 5:23:48 PM CEST&lt;BR /&gt;
Friday April 26 2019 5:22:08 PM CEST&lt;BR /&gt;
Friday August 16 2019 12:44:31 PM CEST&lt;BR /&gt;
Friday August 9 2019 5:29:40 PM CEST&lt;BR /&gt;
Friday December 13 2019 2:11:15 AM CET&lt;BR /&gt;
Friday December 20 2019 12:32:19 PM CET&lt;BR /&gt;
Friday December 20 2019 12:32:21 PM CET&lt;BR /&gt;
Friday December 20 2019 12:42:35 PM CET&lt;BR /&gt;
Friday December 6 2019 9:35:07 AM CET&lt;BR /&gt;
Friday February 1 2019 4:14:16 PM CET&lt;BR /&gt;
Friday February 1 2019 4:25:06 PM CET&lt;BR /&gt;
Friday February 1 2019 4:36:21 PM CET&lt;BR /&gt;
Friday February 1 2019 8:27:19 PM CET&lt;BR /&gt;
Friday February 22 2019 5:17:29 PM CET&lt;BR /&gt;
Friday February 22 2019 5:17:53 PM CET&lt;BR /&gt;
Friday February 22 2019 8:18:31 PM CET&lt;BR /&gt;
Friday February 8 2019 10:03:56 PM CET&lt;BR /&gt;
Friday February 8 2019 11:00:07 AM CET&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I tried the following search&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;[My Search]&lt;BR /&gt;
| eval Created_Time_timestamp=strptime("Created Time", "&lt;STRONG&gt;%A %B %e %Y %I:%M:%S %p %Z&lt;/STRONG&gt;")&lt;BR /&gt;
| table "Global Id", "Created Time", Created_Time_timestamp&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;But "Created_Time_timestamp" stay empty&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Global Id                                                             Created Time                                                             Created_Time_timestamp&lt;BR /&gt;
4a003a1203468c82b5b16c6877f2bac1  Thursday December 26 2019 10:23:25 AM CET&lt;BR /&gt;&lt;BR /&gt;
4a01b7d12e0a96078b31c8c109efe428  Thursday December 26 2019 12:35:38 PM CET&lt;BR /&gt;&lt;BR /&gt;
4a036467deb8077f9ce0115fae8115b3  Thursday December 26 2019 10:23:19 AM CET&lt;BR /&gt;&lt;BR /&gt;
4a0428dc18231232af4588a95d26ca4a  Tuesday January 15 2019 6:01:56 PM CET&lt;BR /&gt;&lt;BR /&gt;
4a0435ed94329293bcc019297385fd7a  Tuesday January 22 2019 6:02:07 PM CET&lt;BR /&gt;&lt;BR /&gt;
4a0915459109146eb0a02f49d5b6946d  Thursday December 26 2019 10:23:19 AM CET&lt;BR /&gt;&lt;BR /&gt;
4a09af63013a323681b9ea494710d6ae  Wednesday January 23 2019 5:03:20 PM CET&lt;BR /&gt;&lt;BR /&gt;
4a0a85212b65c1fc9bed8fbddf8f9b58          Thursday January 24 2019 12:58:22 PM CET&lt;BR /&gt;&lt;BR /&gt;
4a0b1be513465e5a8bd5379e2226a7e3  Wednesday August 21 2019 12:45:47 PM CEST&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I don't succed to find a solution.&lt;BR /&gt;
Is there someone who could have an idea ?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:42:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485783#M83158</guid>
      <dc:creator>erwanlebaron</dc:creator>
      <dc:date>2020-09-30T03:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Issue to find the format to convert string to date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485784#M83159</link>
      <description>&lt;P&gt;Hi @erwanlebaron,&lt;BR /&gt;
strptime command converts a string in epochtime, if you want it in a human readable format (e.g. mm/dd/yyyy HH:MM:SS) you have to use strptime and strtftime, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [My Search]
| eval Created_Time_timestamp=strftime(strptime("Created Time", "%A %B %e %Y %I:%M:%S %p %Z"),"%m/%d/%Y %H:%M:%S")
| table "Global Id", "Created Time", Created_Time_timestamp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If it continues to dot run, rename fields with spaces and try again:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[My Search]
| rename "Created Time" AS Created_Time
| eval Created_Time_timestamp=strftime(strptime(Created_Time,"%A %B %e %Y %I:%M:%S %p %Z"),"%m/%d/%Y %H:%M:%S")
| table "Global Id" Created_Time Created_Time_timestamp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 12:45:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485784#M83159</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-01-21T12:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Issue to find the format to convert string to date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485785#M83160</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Check this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval date="Friday April 19 2019 5:23:48 PM CEST,Friday February 8 2019 11:00:07 AM CET" 
| makemv delim="," date 
| mvexpand date 
| eval epoch =strptime(date,"%A %B %d %Y %I:%M:%S %p %Z")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 12:48:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485785#M83160</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2020-01-21T12:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Issue to find the format to convert string to date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485786#M83161</link>
      <description>&lt;P&gt;Hi @erwanlebaron,&lt;BR /&gt;
can you try this format: &lt;CODE&gt;**%A %B %d %Y %I:%M:%S %p %Z**&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval time="Friday April 19 2019 5:23:48 PM CEST"
| eval x=strftime(strptime(time,"%A %B %d %Y %I:%M:%S %p %Z"),"%Y-%m-%d %H:%M:%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 14:18:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485786#M83161</guid>
      <dc:creator>TISKAR</dc:creator>
      <dc:date>2020-01-21T14:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Issue to find the format to convert string to date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485787#M83162</link>
      <description>&lt;P&gt;The timeformat in your query is fine. The problem is the how you've specified your field name in the eval. The field name contains space (special character), so it should be enclosed within single quotes when using in the expressions of eval and where (for eval right side of the &lt;CODE&gt;=&lt;/CODE&gt;). So if you change your eval like below, it would work just fine.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;My Search
| eval Created_Time_timestamp=strptime('Created Time', "%A %B %e %Y %I:%M:%S %p %Z")
| table "Global Id", "Created Time", Created_Time_timestamp
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 19:06:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485787#M83162</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-01-21T19:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Issue to find the format to convert string to date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485788#M83163</link>
      <description>&lt;P&gt;The issue came from field "Created Time" with space...I add the rename of my field without space and it works&lt;/P&gt;

&lt;P&gt;Thanks Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 12:31:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485788#M83163</guid>
      <dc:creator>erwanlebaron</dc:creator>
      <dc:date>2020-01-22T12:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Issue to find the format to convert string to date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485789#M83164</link>
      <description>&lt;P&gt;The issue came from field "Created Time" with space...I add the rename of my field without space and it works&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 12:31:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485789#M83164</guid>
      <dc:creator>erwanlebaron</dc:creator>
      <dc:date>2020-01-22T12:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Issue to find the format to convert string to date</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485790#M83165</link>
      <description>&lt;P&gt;My day number is the format %e and not %d.&lt;BR /&gt;
The issue came from the field name with the space.&lt;/P&gt;

&lt;P&gt;Anyway thanks of having taken time to answer&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 12:33:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Issue-to-find-the-format-to-convert-string-to-date/m-p/485790#M83165</guid>
      <dc:creator>erwanlebaron</dc:creator>
      <dc:date>2020-01-22T12:33:56Z</dc:date>
    </item>
  </channel>
</rss>

