<?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: Specify timezone when parsing CSV data? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Specify-timezone-when-parsing-CSV-data/m-p/304300#M221974</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/82312"&gt;@HansH&lt;/a&gt;&amp;nbsp; &amp;nbsp;I am not sure if this helps but just yesterday i had to use the argument in the reader jdbc connection string like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;?serverTimezone=UTC&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Oct 2020 17:05:48 GMT</pubDate>
    <dc:creator>stevenmatison</dc:creator>
    <dc:date>2020-10-13T17:05:48Z</dc:date>
    <item>
      <title>Specify timezone when parsing CSV data?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Specify-timezone-when-parsing-CSV-data/m-p/304269#M221961</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we are using Apache NiFi to process CSV data that contains time stamps without a specified time zone.&amp;nbsp; By default, it seems that NiFi considers timestamps parsed by CSVReader with a parse specification like "yyyy-MM-dd HH:mm:ss" to be in UTC, no matter what the user.timezone property of the JVM or the TZ environment variable is set to.&amp;nbsp; Is there a way to force the parsing to happen in a specific or the system time zone instead?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Hans&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 09:16:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Specify-timezone-when-parsing-CSV-data/m-p/304269#M221961</guid>
      <dc:creator>HansH</dc:creator>
      <dc:date>2020-10-13T09:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Specify timezone when parsing CSV data?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Specify-timezone-when-parsing-CSV-data/m-p/304300#M221974</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/82312"&gt;@HansH&lt;/a&gt;&amp;nbsp; &amp;nbsp;I am not sure if this helps but just yesterday i had to use the argument in the reader jdbc connection string like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;?serverTimezone=UTC&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 17:05:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Specify-timezone-when-parsing-CSV-data/m-p/304300#M221974</guid>
      <dc:creator>stevenmatison</dc:creator>
      <dc:date>2020-10-13T17:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Specify timezone when parsing CSV data?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Specify-timezone-when-parsing-CSV-data/m-p/304439#M222035</link>
      <description>&lt;P&gt;After I have not been able to find a solution that would be easy to implement inside of NiFi, I've written a small perl (yuk) script that can be used to adjust timestamps in a CSV file to be in ISO8601 format.&amp;nbsp; Maybe it is useful to someone else:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;#!/bin/perl -w

# This perl script adds timezone information to timestamps without a
# timezone.  All timestamps in the input file that follow the format
# "YYYY-MM-DD HH:MM:SS" are converted to ISO8601 timestamps.

use strict;

use DateTime::Format::Strptime;

my $time_zone = 'Europe/Amsterdam';
my $parser = DateTime::Format::Strptime-&amp;gt;new(
    pattern   =&amp;gt; '%Y-%m-%d %T',
    time_zone =&amp;gt; $time_zone
    );
my $printer = DateTime::Format::Strptime-&amp;gt;new(
    pattern   =&amp;gt; '%FT%T%z',
    time_zone =&amp;gt; $time_zone
    );

while (&amp;lt;&amp;gt;) {
    s/(?&amp;lt;=")(\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d)(?=")/
        my $dt = $parser-&amp;gt;parse_datetime($1);
        $printer-&amp;gt;format_datetime($dt);
    /ge;
    print;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 08:53:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Specify-timezone-when-parsing-CSV-data/m-p/304439#M222035</guid>
      <dc:creator>HansH</dc:creator>
      <dc:date>2020-10-16T08:53:43Z</dc:date>
    </item>
  </channel>
</rss>

