iOS WebView 显示以不同方式返回经典 ASP 页面日期时间
iOS WebView display returned classic ASP page date time differently
从经典 ASP 页面经过的日期时间显示在 WebView
处,如下所示。如何将其更改为正确的 DD-MM-YYYY HH:MM:SS?我是否需要在经典 ASP 页面将日期时间转换为字符串,或者我可以在 iOS 做一些事情来纠正这个问题。
Asp经典
<%
fpx_sellerTxnTime = request.Form("fpx_sellerTxnTime")
%>
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SHARE FITNESS</title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="main">
<!---728x90--->
<h1>Payment Receipt</h1>
<div class="content">
<div class="sap_tabs">
<div id="horizontalTab" style="display: block; width: 100%; margin: 0px;">
<div class="resp-tabs-container">
<h2 class="resp-accordion resp-tab-active" role="tab" aria-controls="tab_item-0"><span class="resp-arrow"></span>Credit Card</h2><div class="tab-1 resp-tab-content resp-tab-content-active" aria-labelledby="tab_item-0" style="display:block">
<div class="payment-info">
<form action="fpx_confirm.php" method="post">
<div style="color:black;border: 1px solid black;" >
<table style = "margin:5px;text-align:left;">
<tr>
<th style="text-align:right;">Date & Time :</th> <th>  <%=fpx_sellerTxnTime%></th>
</tr>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
像这样的东西应该可以完成工作。
<%
Dim date_string: date_string = "20180416122649"
Response.Write ParseStringDate(date_string)
Function ParseStringDate(value)
Dim dt(5)
Dim fmt: fmt = Array(4, 2, 2, 2, 2, 2)
Dim pos: pos = 1
Dim i, s
If Len(value & "") > 0 Then
For i = 0 To UBound(dt)
s = Mid(value, pos, fmt(i))
If Len(s) > 0 And IsNumeric(s) And i < 3 Then dt(i) = CInt(s) Else dt(i) = s
pos = pos + fmt(i)
Next
value = CDate(DateSerial(dt(0), dt(1), dt(2)) & " " & TimeValue(dt(3) & ":" & dt(4) & ":" & dt(5)))
End If
ParseStringDate = value
End Function
%>
输出:
16/04/2018 12:26:49
从经典 ASP 页面经过的日期时间显示在 WebView
处,如下所示。如何将其更改为正确的 DD-MM-YYYY HH:MM:SS?我是否需要在经典 ASP 页面将日期时间转换为字符串,或者我可以在 iOS 做一些事情来纠正这个问题。
Asp经典
<%
fpx_sellerTxnTime = request.Form("fpx_sellerTxnTime")
%>
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SHARE FITNESS</title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="main">
<!---728x90--->
<h1>Payment Receipt</h1>
<div class="content">
<div class="sap_tabs">
<div id="horizontalTab" style="display: block; width: 100%; margin: 0px;">
<div class="resp-tabs-container">
<h2 class="resp-accordion resp-tab-active" role="tab" aria-controls="tab_item-0"><span class="resp-arrow"></span>Credit Card</h2><div class="tab-1 resp-tab-content resp-tab-content-active" aria-labelledby="tab_item-0" style="display:block">
<div class="payment-info">
<form action="fpx_confirm.php" method="post">
<div style="color:black;border: 1px solid black;" >
<table style = "margin:5px;text-align:left;">
<tr>
<th style="text-align:right;">Date & Time :</th> <th>  <%=fpx_sellerTxnTime%></th>
</tr>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
像这样的东西应该可以完成工作。
<%
Dim date_string: date_string = "20180416122649"
Response.Write ParseStringDate(date_string)
Function ParseStringDate(value)
Dim dt(5)
Dim fmt: fmt = Array(4, 2, 2, 2, 2, 2)
Dim pos: pos = 1
Dim i, s
If Len(value & "") > 0 Then
For i = 0 To UBound(dt)
s = Mid(value, pos, fmt(i))
If Len(s) > 0 And IsNumeric(s) And i < 3 Then dt(i) = CInt(s) Else dt(i) = s
pos = pos + fmt(i)
Next
value = CDate(DateSerial(dt(0), dt(1), dt(2)) & " " & TimeValue(dt(3) & ":" & dt(4) & ":" & dt(5)))
End If
ParseStringDate = value
End Function
%>
输出:
16/04/2018 12:26:49