<?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: working with dates in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593729#M46524</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dan!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´m not very expert in this "blog".. Sorry for your inconvenience.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before this message, is the code in python format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code works in ArcMap but when I want export like a geoprocessing service in WebAppBuilder doesn´t work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be welcome!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank U for all!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Mar 2017 12:58:14 GMT</pubDate>
    <dc:creator>SantiagoPrieto</dc:creator>
    <dc:date>2017-03-12T12:58:14Z</dc:date>
    <item>
      <title>working with dates</title>
      <link>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593726#M46521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello! I'm Santi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried make a python code that update a field with machine's date. This results compares another fix field and offers a result in another field.&lt;/P&gt;&lt;P&gt;I need update a field from another one using an intermediate field. This script works in ArcMap but when I try publish as service in WebAppbuilder not works.&lt;/P&gt;&lt;P&gt;Code is below:&lt;/P&gt;&lt;P&gt;"import arcpy&lt;BR /&gt;import datetime&lt;BR /&gt;arcpy.env.workspace = r'C:\1.SANTI\TFM\20160726_Entrega_VALLADOLID\20160726_Entrega_VALLADOLID\CAPAS_ETRS_89_PARA_PROYECTO\PRUEBAS_ONLINE_2.gdb'&lt;BR /&gt;capa = arcpy.GetParameterAsText(0)&lt;BR /&gt;current_datetime = datetime.datetime.now()&lt;BR /&gt;arcpy.CalculateField_management(capa, "dia_actual", datetime.datetime.weekday(current_datetime))&lt;BR /&gt;##print(current_datetime.strftime('%A'))&lt;BR /&gt;campos = ['dia_actual', 'dia_libre', 'estado']&lt;BR /&gt;with arcpy.da.UpdateCursor (capa, campos) as cursor:&lt;BR /&gt; for row in cursor:&lt;BR /&gt; if(row [0]==row[1]):&lt;BR /&gt; row[2]=2&lt;BR /&gt; elif (row[0]&amp;lt;&amp;gt;row[1]):&lt;BR /&gt; row[2]=1&lt;BR /&gt; cursor.updateRow(row)"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why doesn't work in WebAppbuilder? Do I need make something before publish as service?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank U for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If somebody answer to my mail too this is: &lt;A href="mailto:santi04082001@gmail.com"&gt;santi04082001@gmail.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank U again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Mar 2017 14:51:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593726#M46521</guid>
      <dc:creator>SantiagoPrieto</dc:creator>
      <dc:date>2017-03-11T14:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: working with dates</title>
      <link>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593727#M46522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Santi... could you format your code in the post please &lt;A _jive_internal="true" href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;Code formatting the Basics++&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And your code may work in ArcMap&amp;nbsp;WebAppbuilder, but I suspect that the programming environments are not exact.&amp;nbsp; Is this&amp;nbsp;the...&lt;STRONG&gt; &lt;A href="https://developers.arcgis.com/web-appbuilder/"&gt;WebAppbuilder &lt;/A&gt;&lt;/STRONG&gt;...you are referring to?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Mar 2017 15:35:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593727#M46522</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-03-11T15:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: working with dates</title>
      <link>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593728#M46523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; datetime
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\1.SANTI\TFM\20160726_Entrega_VALLADOLID\20160726_Entrega_VALLADOLID\CAPAS_ETRS_89_PARA_PROYECTO\PRUEBAS_ONLINE_2.gdb'&lt;/SPAN&gt;
capa &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetParameterAsText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
current_datetime &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;now&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CalculateField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;capa&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"dia_actual"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;weekday&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;current_datetime&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;##print(current_datetime.strftime('%A'))&lt;/SPAN&gt;
campos &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'dia_actual'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'dia_libre'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'estado'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;capa&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; campos&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;
 &lt;SPAN class="keyword token"&gt;elif&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;lt;&amp;gt;&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
 row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
 cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:30:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593728#M46523</guid>
      <dc:creator>SantiagoPrieto</dc:creator>
      <dc:date>2021-12-12T01:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: working with dates</title>
      <link>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593729#M46524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Dan!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I´m not very expert in this "blog".. Sorry for your inconvenience.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before this message, is the code in python format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code works in ArcMap but when I want export like a geoprocessing service in WebAppBuilder doesn´t work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be welcome!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank U for all!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Mar 2017 12:58:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593729#M46524</guid>
      <dc:creator>SantiagoPrieto</dc:creator>
      <dc:date>2017-03-12T12:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: working with dates</title>
      <link>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593730#M46525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hate dates and time...&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; datetime &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; datetime

noww &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;now&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
noww
datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2017&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;12&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;9&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;58&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;27&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;29985&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;noww&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="string token"&gt;'2017-03-12 09:58:27.029985'&lt;/SPAN&gt;

b &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'2017-03-12 09:58:27.029985'&lt;/SPAN&gt;

b &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; noww
&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;

b &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;noww&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;so, just make sure your input date is either a datetime object in order to compare, or compare the string representations of both... Not sure that answers your question, but it is early...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:30:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593730#M46525</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T01:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: working with dates</title>
      <link>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593731#M46526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may also want to ask your question in &lt;A href="https://community.esri.com/space/2150"&gt;Web AppBuilder for ArcGIS&lt;/A&gt;‌.&amp;nbsp; I don't believe AppBuilder has a widget to calculate fields, although it is being suggested as an idea &lt;A _jive_internal="true" href="https://community.esri.com/ideas/10237"&gt;Calculate Field widget&lt;/A&gt;. You may need to use the &lt;A href="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Calculate_Feature_Service_Layer/02r30000029n000000/"&gt;REST API Calculate operation&lt;/A&gt;&amp;nbsp;to accomplish this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2017 17:16:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/working-with-dates/m-p/593731#M46526</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2017-03-13T17:16:38Z</dc:date>
    </item>
  </channel>
</rss>

