<?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>question Re: NiFI: how can i  convert string to date in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFI-how-can-i-convert-string-to-date/m-p/316946#M226955</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've just noticed your date strings in the sample aren't consistent which will make things difficult I think.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example in line 1 your OrderDate format is "M/dd/yyyy" (single digit month) and in ship date it seems to be "MM/dd/yyyy" (double digit month).&amp;nbsp; For the CSV to work correctly all of your date fields would need to adhere to the same format I believe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do a couple of things to resolve this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Fix it in the source.&amp;nbsp; The best option in my opinion, if possible.&lt;/LI&gt;&lt;LI&gt;Clean the data in NiFi before it arrives at the PutDatabaseRecord processor.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Unfortunately the second is a touch beyond my current level of expertise, but if I was you I would explore either ReplaceText processor with the appropriately regex expression, or a an UpdateRecord processor with a SQL like statement to update this field in the flowfile - note though this would would require a separate CSVReader service that reads your data as strings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Fri, 21 May 2021 21:23:56 GMT</pubDate>
    <dc:creator>_mark_</dc:creator>
    <dc:date>2021-05-21T21:23:56Z</dc:date>
    <item>
      <title>NiFI: how can i  convert string to date</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFI-how-can-i-convert-string-to-date/m-p/316569#M226841</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I trying to put some data from my CSV to my database but i got some error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Acbx_0-1621281201378.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/31206i6382C776F753C5CA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Acbx_0-1621281201378.png" alt="Acbx_0-1621281201378.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Settings UpdateRecord&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Acbx_1-1621281273565.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/31207i915589EB66DE5804/image-size/large?v=v2&amp;amp;px=999" role="button" title="Acbx_1-1621281273565.png" alt="Acbx_1-1621281273565.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Settings about CSVRecordSetWriter&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Acbx_2-1621281343928.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/31208i2422B20A5958A97C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Acbx_2-1621281343928.png" alt="Acbx_2-1621281343928.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My csv file:&lt;/P&gt;&lt;TABLE border="0" width="200pt" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="64" height="15"&gt;Region&lt;/TD&gt;&lt;TD width="64"&gt;Country&lt;/TD&gt;&lt;TD width="64"&gt;ItemType&lt;/TD&gt;&lt;TD width="64"&gt;SalesChannel&lt;/TD&gt;&lt;TD width="64"&gt;OrderPriority&lt;/TD&gt;&lt;TD width="64"&gt;OrderDate&lt;/TD&gt;&lt;TD width="64"&gt;OrderID&lt;/TD&gt;&lt;TD width="64"&gt;ShipDate&lt;/TD&gt;&lt;TD width="64"&gt;UnitsSold&lt;/TD&gt;&lt;TD width="64"&gt;UnitPrice&lt;/TD&gt;&lt;TD width="64"&gt;UnitCost&lt;/TD&gt;&lt;TD width="64"&gt;TotalRevenue&lt;/TD&gt;&lt;TD width="64"&gt;TotalCost&lt;/TD&gt;&lt;TD width="64"&gt;TotalProfit&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="15"&gt;Sub-Saharan Africa&lt;/TD&gt;&lt;TD&gt;Chad&lt;/TD&gt;&lt;TD&gt;Office Supplies&lt;/TD&gt;&lt;TD&gt;Online&lt;/TD&gt;&lt;TD&gt;L&lt;/TD&gt;&lt;TD&gt;1/27/2011&lt;/TD&gt;&lt;TD&gt;292494523&lt;/TD&gt;&lt;TD&gt;02/12/2011&lt;/TD&gt;&lt;TD&gt;4484&lt;/TD&gt;&lt;TD&gt;651.21&lt;/TD&gt;&lt;TD&gt;524.96&lt;/TD&gt;&lt;TD&gt;2920025.64&lt;/TD&gt;&lt;TD&gt;2353920.64&lt;/TD&gt;&lt;TD&gt;566105.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="15"&gt;Europe&lt;/TD&gt;&lt;TD&gt;Latvia&lt;/TD&gt;&lt;TD&gt;Beverages&lt;/TD&gt;&lt;TD&gt;Online&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;12/28/2015&lt;/TD&gt;&lt;TD&gt;361825549&lt;/TD&gt;&lt;TD&gt;1/23/2016&lt;/TD&gt;&lt;TD&gt;1075&lt;/TD&gt;&lt;TD&gt;47.45&lt;/TD&gt;&lt;TD&gt;31.79&lt;/TD&gt;&lt;TD&gt;51008.75&lt;/TD&gt;&lt;TD&gt;34174.25&lt;/TD&gt;&lt;TD&gt;16834.50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="15"&gt;Middle East and North Africa&lt;/TD&gt;&lt;TD&gt;Pakistan&lt;/TD&gt;&lt;TD&gt;Vegetables&lt;/TD&gt;&lt;TD&gt;Offline&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1/13/2011&lt;/TD&gt;&lt;TD&gt;141515767&lt;/TD&gt;&lt;TD&gt;02/01/2011&lt;/TD&gt;&lt;TD&gt;6515&lt;/TD&gt;&lt;TD&gt;154.06&lt;/TD&gt;&lt;TD&gt;90.93&lt;/TD&gt;&lt;TD&gt;1003700.90&lt;/TD&gt;&lt;TD&gt;592408.95&lt;/TD&gt;&lt;TD&gt;411291.95&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="15"&gt;Sub-Saharan Africa&lt;/TD&gt;&lt;TD&gt;Democratic Republic of the Congo&lt;/TD&gt;&lt;TD&gt;Household&lt;/TD&gt;&lt;TD&gt;Online&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;09/11/2012&lt;/TD&gt;&lt;TD&gt;500364005&lt;/TD&gt;&lt;TD&gt;10/06/2012&lt;/TD&gt;&lt;TD&gt;7683&lt;/TD&gt;&lt;TD&gt;668.27&lt;/TD&gt;&lt;TD&gt;502.54&lt;/TD&gt;&lt;TD&gt;5134318.41&lt;/TD&gt;&lt;TD&gt;3861014.82&lt;/TD&gt;&lt;TD&gt;1273303.59&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="15"&gt;Europe&lt;/TD&gt;&lt;TD&gt;Czech Republic&lt;/TD&gt;&lt;TD&gt;Beverages&lt;/TD&gt;&lt;TD&gt;Online&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;10/27/2015&lt;/TD&gt;&lt;TD&gt;127481591&lt;/TD&gt;&lt;TD&gt;12/05/2015&lt;/TD&gt;&lt;TD&gt;3491&lt;/TD&gt;&lt;TD&gt;47.45&lt;/TD&gt;&lt;TD&gt;31.79&lt;/TD&gt;&lt;TD&gt;165647.95&lt;/TD&gt;&lt;TD&gt;110978.89&lt;/TD&gt;&lt;TD&gt;54669.06&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 17 May 2021 20:00:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFI-how-can-i-convert-string-to-date/m-p/316569#M226841</guid>
      <dc:creator>Acbx</dc:creator>
      <dc:date>2021-05-17T20:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: NiFI: how can i  convert string to date</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFI-how-can-i-convert-string-to-date/m-p/316945#M226954</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check your "Date Format" setting in the CSVReader service where you can specify a format string to interpreting text as a date.&amp;nbsp; At a guess either "M/dd/yyyy" or M/dd/yyyy" would work based on the data sample provided.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More information on date format strings here:&amp;nbsp;&lt;A href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html" target="_blank"&gt;https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an aside, I don't think the CSVRecordSetWriter settings are much use here as you're terminating all outbound PutDatabaseRecord relationships.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 21:05:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFI-how-can-i-convert-string-to-date/m-p/316945#M226954</guid>
      <dc:creator>_mark_</dc:creator>
      <dc:date>2021-05-21T21:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: NiFI: how can i  convert string to date</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFI-how-can-i-convert-string-to-date/m-p/316946#M226955</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've just noticed your date strings in the sample aren't consistent which will make things difficult I think.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example in line 1 your OrderDate format is "M/dd/yyyy" (single digit month) and in ship date it seems to be "MM/dd/yyyy" (double digit month).&amp;nbsp; For the CSV to work correctly all of your date fields would need to adhere to the same format I believe.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can do a couple of things to resolve this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Fix it in the source.&amp;nbsp; The best option in my opinion, if possible.&lt;/LI&gt;&lt;LI&gt;Clean the data in NiFi before it arrives at the PutDatabaseRecord processor.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Unfortunately the second is a touch beyond my current level of expertise, but if I was you I would explore either ReplaceText processor with the appropriately regex expression, or a an UpdateRecord processor with a SQL like statement to update this field in the flowfile - note though this would would require a separate CSVReader service that reads your data as strings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 21:23:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFI-how-can-i-convert-string-to-date/m-p/316946#M226955</guid>
      <dc:creator>_mark_</dc:creator>
      <dc:date>2021-05-21T21:23:56Z</dc:date>
    </item>
  </channel>
</rss>

