Model Builder:  Calculate Field with Date Parameter Results in Odd Time Value

2028
3
06-18-2014 01:54 PM
KirstenFrost_Andersen
New Contributor III
I'm trying to build a model in which I have a Date data type Parameter that is used in the Calculate Field tool that places that value in a field of a feature class.  See attached screenshot.  If the variable is '6/19/2014' the field in the feature class displays '12:00:14 AM'.  If the variable is '5/2/11' or '05/02/2011' it results in '12:01:47 AM'.  If the user defines a date and runs the model as a tool, it comes out at '12:00:00 AM'.  The field in the feature class is a date field type.  How do I force the date into the feature class field as an actual date with no time (or date plus generic time 12:00:00)??

[ATTACH=CONFIG]34710[/ATTACH]
0 Kudos
3 Replies
GinoMellino
Occasional Contributor

Hello Kirsten, 

Apologies for reviving an old post but did you ever get an answer to this? I have the same issue!

Cheers,

Gino

0 Kudos
curtvprice
MVP Esteemed Contributor

This is a little tricky because so many data formats have different storage formats. Date fields in dbf (shapefiles) don't even support time!

There are some good examples in the help here:

Calculate Field examples—Help | ArcGIS Desktop 

0 Kudos
GinoMellino
Occasional Contributor

Thank you for your response...Embarrassingly it turned out to simply need the quotation marks. I am using inline variables so I just changed it from %Observation Date% to '%Observation Date%' and it worked. 

Cheers

Gino

0 Kudos