using dijit.form.DateTextBox and dijit.form.TimeTextBox with geodatabase

1005
1
05-23-2012 10:13 AM
AndrewDuff
New Contributor
Im working on a javascript web page to allow spatial data to be directly entered to a geodatabase.  Does anybody have some sample code for formmating dates and times for entry into the geodatabase from dijit.form.DateTextBox and dijit.form.TimeTextBox?

Im able to successfully get the values from the controls using

var od = dojo.byId("dateval").value;
var ot = dojo.byId("timeval").value;

which result in

od = "5/8/2012"

and

ot = "11:30 AM"

which I thought would be easy to assign to attributes of a graphic and submit but I am having trouble and my code is failing when I submit those attributes to featureLayer.applyEdits.  Do I need some special formatting before assigning these values to a esri.Graphic so that they can go into a geodatabase date field properly (im on SDE 10 and SQL server 2008).  Sure I could store these values in text fields but that kind of defeats the point of geodatabase dates.

Thanks for your help,

Andy
0 Kudos
1 Reply
AndrewLeane
New Contributor II
Hi Andy,

I just tried to do this myself and had the same issue. Looks like the current date format as defined in the ArcGIS REST API docs is based on millisecond epoch time. When I called applyEdits with the date in that format, it went through fine.

Form the REST API:
GPDate
The value for GPDate data type is a number that represents the number of milliseconds since epoch (January 1, 1970) in UTC.
0 Kudos