Reputation: 21
Please see the issue details and share the solution if you have. Thank you in advance. Issue: Windows 2012/IIS 8.5 Classic ASP date format changing when we append with string. For example, date value 01/12/2016 (Jan 12th 2016) have been changed to 12/01/2016 (Dec 1st 2016) if we append with the string.
Source Code: (date.asp)
<%
Dim fordate
Dim fdate
fordate = Request.QueryString("fordate")
Response.Write(fordate)
fdate = cdate(fordate)
Response.Write(fdate)
Dim strsql
strsql = "exec testsp " & fdate
Response.Write(strsql)
%>
Upvotes: 1
Views: 1736
Reputation: 16672
When casting Date / Time to a String in VBScript the following applies
Quote from MSDN - VBScript Reference - CStr Function
A String containing a date in the short-date format of your system
The effect by default whatever the "short-date" format settings are for dates values on the system# (usually found under Control Panel -> Language
but varies by OS) is used when displaying String representations of date values in VBScript.
# - By "System" we mean the Server / Computer whether it be in a client / server side environment.
Upvotes: 1