AnsweredAssumed Answered

Calculate Date Field.

Question asked by jay.kapalczynski on Oct 4, 2016
Latest reply on Oct 4, 2016 by jay.kapalczynski

I am trying to calculate a date/time field in Python with not much luck...

 

In ArcGIS I am doing this with a calculate and it calculates fine...its going into a Date Field.

(Right("00" & [Hour],2) + ":" + Right("00" & [Minute],2))

result:  4:02:00 PM

 

I want to do this in Python and am trying this after reading in a CSV File.  No error but no result in the feature class created.

If I dont get the syntax correct it tells me "Right" is not defined

Hour = str(lineSplit[3])
Minute = str(lineSplit[4])

CalcDate1 = "Right('00' & Hour,2) & ':' & Right('00' & Minute,2)"
print CalcDate1

 

It gives me this in the results window in the shell:

Right('00' & Hour,2) & ':' & Right('00' & Minute,2)

Outcomes