<?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 Dates Dissapearing? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/dates-dissapearing/m-p/559772#M43786</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to go from a table&amp;nbsp; (csv file) to a feature class. I have a field called "Dates". When I put the table in and check its field type it says it is of type "Date" (which is what I need) and every record is filled out. However, when I create a feature class:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.MakeXYEventLayer_management(in_table,x_coord,y_coord,out_table,spatialRef)&lt;/PRE&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My output is a feature class.. but with "NULL" dates. I tried to do this by right clicking the table and telling it to display XY data. But The same problem happens. All the dates dissapear.. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the dates are in the following form : 08/08/2012&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any reason why this could happen?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2012 22:17:49 GMT</pubDate>
    <dc:creator>ZulyG</dc:creator>
    <dc:date>2012-08-07T22:17:49Z</dc:date>
    <item>
      <title>Dates Dissapearing?</title>
      <link>https://community.esri.com/t5/python-questions/dates-dissapearing/m-p/559772#M43786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to go from a table&amp;nbsp; (csv file) to a feature class. I have a field called "Dates". When I put the table in and check its field type it says it is of type "Date" (which is what I need) and every record is filled out. However, when I create a feature class:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.MakeXYEventLayer_management(in_table,x_coord,y_coord,out_table,spatialRef)&lt;/PRE&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My output is a feature class.. but with "NULL" dates. I tried to do this by right clicking the table and telling it to display XY data. But The same problem happens. All the dates dissapear.. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the dates are in the following form : 08/08/2012&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any reason why this could happen?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 22:17:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dates-dissapearing/m-p/559772#M43786</guid>
      <dc:creator>ZulyG</dc:creator>
      <dc:date>2012-08-07T22:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dates Dissapearing?</title>
      <link>https://community.esri.com/t5/python-questions/dates-dissapearing/m-p/559773#M43787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Loading dates is always tricky. Do you have a schema.ini file to define the schema of your csv file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That will help a lot. You will also have to have your date defined in a format that Microsoft can understand.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You specify the DateTimeFormat in the schema.ini file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that is not working, then you will need to run a script that reads in the date as a string field, parse it to a python datetime object and then write it out to a date field. I hope you are not using shapefiles, because that can only handle a date without time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See the GPX to Featureclass conversion tool in 10.1 for an example. Unfortunately the tool to do this conversion does not work in 10.1, so I wrote a Python snippet:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;from datetime import datetime from dateutil import tz ## xxxxxxxxxxxxxx snip xxxxxxxxxxxxxxxxx &amp;nbsp;&amp;nbsp;&amp;nbsp; cur = arcpy.InsertCursor(outFC,srWGS84)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; # Loop over each point in the tree and put the information inside a new row &amp;nbsp;&amp;nbsp;&amp;nbsp; # &amp;nbsp;&amp;nbsp;&amp;nbsp; for index, trkPoint in enumerate(GeneratePointFromXML(tree)): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if trkPoint.asPoint() is not None: ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rowsDA.insertRow([trkPoint.name, trkPoint.desc, trkPoint.gpxtype, trkPoint.t, ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; float(trkPoint.z), float(trkPoint.x), float(trkPoint.y), float(trkPoint.z)]) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row = cur.newRow() &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Name = trkPoint.name &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Descript = trkPoint.desc &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Type = trkPoint.gpxtype &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.DateTimeS = trkPoint.t &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # convert UTC to nz using Python because ArcGIS tool crashes at 10.0 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; utc = datetime.strptime(trkPoint.t,'%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=from_zone) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Tell the datetime object that it's in UTC time zone since&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # datetime objects are 'naive' by default &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Convert time zone back for ArcGIS &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; local = utc.astimezone(to_zone).replace(tzinfo=None) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.DateTime = local &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Elevation = float(trkPoint.z) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.shape = arcpy.Point(float(trkPoint.x), float(trkPoint.y), float(trkPoint.z)) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cur.insertRow(row) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; badPt +=1&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 22:39:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dates-dissapearing/m-p/559773#M43787</guid>
      <dc:creator>KimOllivier</dc:creator>
      <dc:date>2012-08-07T22:39:00Z</dc:date>
    </item>
  </channel>
</rss>

