Search code examples
iosobjective-casp-classicuiwebview

iOS WebView display returned classic ASP page date time differently


The date time that passed from a classic ASP page is displayed at WebView as below. How can I change it to proper DD-MM-YYYY HH:MM:SS? Do i need to convert the date time to string at the classic ASP Page or I can do something at iOS to rectify this issue.

pic

Asp Classic

<%

   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>&nbsp <%=fpx_sellerTxnTime%></th>
                                            </tr>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>  
                </div>
            </div>  
        </div>
    </div>

</body>
</html>

Solution

  • Something like this should do the job.

    <%
    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
    %>
    

    Output:

    16/04/2018 12:26:49