problems retrieving correct datetime value from SDE/SQL Server

Discussion created by clowesj on Jun 24, 2014
Latest reply on Jun 24, 2014 by manish_patel
I'm using the ArcGIS Server JS API to store a new feature using ApplyEdits.
The feature is created sucessfully. One of the feature attributes is a datetime field.

The field value is defined like this:

dt = new Date(2014, 6, 24, 10, 32);
fieldvalue = dt.valueOf();

The time of 10:32 goes into the database as 1402997520000 (the primitive value)

In the SQL Server database the time reads 10:32

When I retrieve the datetime value using the JS API the primitive value is 1402997519999, which displays as : 10:31.5999

Where am I going wrong?