Aij*_*han 23 javascript postgresql ajax wcf jquery
我是Postgresql的新手,我正在使用WCF服务.
这是我的代码片段:
$.ajax({
url: '../Services/AuctionEntryServices.svc/InsertAuctionDetails',
data: JSON.stringify({ "objAuctionEntryEntity": {
"AuctionNO": '',
"AuctionDate": $('[Id$="lblAuctionDateVal"]').text(),
"TraderID": $('[Id$="ddlTraderName"] option:selected').val(),
"Grade": $('[Id$="ddlGrade"] option:selected').val(),
"Varity": $('[Id$="ddlVarity"] option:selected').val(),
"QuntityInAuction": $('#txtQuantityForAuction').val(),
"AuctionRate": $('#txtAuctionRate').val(),
"BrokerID": a[0],
"IsSold": $('#chlIsSold').is(':checked'),
"CreatedBy": $.parseJSON(GetCookie('Admin_User_In_Mandi')).UserID,
"UpdatedBy": $.parseJSON(GetCookie('Admin_User_In_Mandi')).UserID,
"CreationDate": GetCurrentDate().toMSJSON(),
"IsActive": true,
"AuctionTransaction": arrAuctionTransaction,
"MandiID": $.parseJSON(GetCookie('Admin_User_In_Mandi')).MandiID,
"FarmerID": _ownerid,
"AuctionNO": _auctionno,
"AmmanatPattiID": _ammantpattiid,
"ToTraderID": b[0],
"ToTraderName": $('#txtOtherBuyerNameEN').val(),
"ToTraderName_HI": $('#txtOtherBuyerNameHI').val()
}
}),
type: 'POST',
contentType: 'application/json',
dataType: 'json'
});
Run Code Online (Sandbox Code Playgroud)
这里:
$('[Id$="lblAuctionDateVal"]').text() = "20/8/2013 14:52:49"
Run Code Online (Sandbox Code Playgroud)
我的这个领域的数据类型是timestamp without time zone
.
如何将此字符串转换为timestamp without time zone
数据类型?
Erw*_*ter 36
timestamp
(= timestamp without time zone
)的字符串表示形式取决于您的区域设置.因此,为避免导致数据错误或Postgres咳嗽异常的歧义,您有两种选择:
1.)使用ISO 8601格式,与任何区域设置或DateStyle
设置相同:
'2013-08-20 14:52:49'
Run Code Online (Sandbox Code Playgroud)
您可能仍需要显式地转换字符串,其中数据类型不是先验已知的,具体取决于用例:
'2013-08-20 14:52:49'::timestamp
Run Code Online (Sandbox Code Playgroud)
2.)将您的字符串转换为timestamp
使用to_timestamp()
匹配的模板模式:
to_timestamp('20/8/2013 14:52:49', 'DD/MM/YYYY hh24:mi:ss')
Run Code Online (Sandbox Code Playgroud)
Geo*_*lou 17
要将字符串转换为不带时区的时间戳,对于Postgresql,我使用上面的内容
SELECT to_timestamp('23-11-1986 09:30:00', 'DD-MM-YYYY hh24:mi:ss')::timestamp without time zone;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
45685 次 |
最近记录: |