I am attempting to calculate a field based on date and time of two other fields. How should my expression read in ArcPy? Both fields are date type with the values of the ORIGDTDATE reading 11/18/2016 while ORIGDTTIME reading 9:52:00 AM I would like for my new output for ORIGDTDATE to equal 11/18/2016 9:52:00 AM

import arcpy
calcExpression =  [!ORIGDTDATE!] + [!ORIGDTTIME!]
arcpy.CalculateField_management(fc, "ORIGDTDATE",ORIGDTDATE + !ORIGDTTIME!,"PYTHON_9.3")

1 Answer 1


Try this code snippet:

expression =  "!ORIGDTDATE!+\" \"+ !ORIGDTTIME!"
arcpy.CalculateField_management(fc, "ORIGDTDATE",expression,"PYTHON_9.3")
  • This syntax is incorrect for the calcExpression and I do not want to calculate it as a TEXT field.
    – geewest
    Commented Nov 21, 2016 at 19:16
  • updated expression
    – artwork21
    Commented Nov 21, 2016 at 19:17
  • That is also incorrect.
    – geewest
    Commented Nov 21, 2016 at 19:21
  • Ok, updated again, got this to work on existing date field.
    – artwork21
    Commented Nov 21, 2016 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.