Formatting String into Feature Class Date Field

Discussion created by BrokenLegMike on Aug 29, 2011
Latest reply on Sep 6, 2011 by Esox
Hey everyone,

I want to pass a string value from a parameter into a geodatabase date field using CalculateField_management. Each time I run my script, I enter a date of 08/23/2010 into a string parameter and it somehow populates the date in the field as 12:00:15 AM.

Under ArcGIS help, it says that the default format for a date field is mm/dd/yyyy. Somehow the script is formatting it incorrectly. Can anyone suggest how to make sure the formatting from the string to to date field stays the same?

FC = gp.GetParameterAsText(0) # Location of Feature Class
DATE = gp.GetParameterAsText(1) # Date

                gp.CalculateField_management(FC, "DATE_OBSERVATION", DATE, "VB", "")