I'm trying to set the historical version of a layer using ChangeVersion_management, but it's not working in Desktop (10.2.1, 10.5.1). When I export the layer to a new feature class, I'm getting the current features rather than the historical ones. What am I doing wrong?
dtHistorical <SPAN class="operator token">=</SPAN> datetime<SPAN class="punctuation token">.</SPAN>date<SPAN class="punctuation token">(</SPAN><SPAN class="number token">2016</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">12</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">29</SPAN><SPAN class="punctuation token">)</SPAN>
iYear <SPAN class="operator token">=</SPAN> dtHistorical<SPAN class="punctuation token">.</SPAN>year
sLeakSurveyName <SPAN class="operator token">=</SPAN> <SPAN class="string token">"LeakSurvey"</SPAN> <SPAN class="operator token">+</SPAN> str<SPAN class="punctuation token">(</SPAN>iYear<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>sConnectionFile <SPAN class="operator token">+</SPAN> <SPAN class="string token">"/LeakSurvey"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"LyrLeakSurvey"</SPAN><SPAN class="punctuation token">)</SPAN>
sDate <SPAN class="operator token">=</SPAN> dtHistorical<SPAN class="punctuation token">.</SPAN>strftime<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"%m/%d/%Y"</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>ChangeVersion_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"LyrLeakSurvey"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"HISTORICAL"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> sDate<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CopyFeatures_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"LyrLeakSurvey"</SPAN><SPAN class="punctuation token">,</SPAN> sLeakSurveyName<SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
However, the code DOES work in Pro 2.0.1!
Perhaps it's a date formatting issue?