I have tried to insert/update the timestamp in postgis database from javascript, But its not working. I have Timestamp column in postgis with Timestamp without time zone data type.
//My Javascript function is
function save(){
var cTime = get
WebService.saveData('Test', cTime);
}
function getTimeStamp() {
var cDate = new Date();
var sChar = String.fromCharCode(39);
var timeStamp = sChar + cDate.getFullYear() + '-' + (cDate.getMonth() + 1) + '-' + cDate.getDate() + ' ' + cDate.getHours() + ':' + cDate.getMinutes() + ':' + cDate.getSeconds() + '.' + cDate.getMilliseconds() + sChar;
//alert(timeStamp); //'2013-11-5 17:12:15.242'
return timeStamp;
}
//My webservice function is:
<WebMethod(enablesession:=True)> _
Public Function saveData( ByVal name As String,byval cTime as string) As String
try
Dim qryStr As String = "INSERT INTO ODC_Private_Graphics_Data (the_geom,timestamp) VALUES ("' & name & "'," & cTime & ")"
dbObj.Connect()
Dim insertCmd As NpgsqlCommand = New NpgsqlCommand(qryStr, dbObj.dbCon)
Dim affectedRows As Integer = insertCmd.ExecuteNonQuery
dbObj.Disconnect()
insertCmd.Dispose()
insertCmd = Nothing
Catch ex As Exception
Finally
dbObj.Disconnect()
End Try
Please suggest me the format for inserting timestamp in postgis database.Thanks in advance