javascript から postgis データベースにタイムスタンプを挿入/更新しようとしましたが、うまくいきません。タイムゾーンデータ型のないタイムスタンプを使用してpostgisにタイムスタンプ列があります。
//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
postgisデータベースにタイムスタンプを挿入するためのフォーマットを提案してください。よろしくお願いします