Domanda

I have a simple sql script in my classic ASP which is as follows

sql = "SELECT date FROM sales WHERE userid=1"
Set RS = Conn.Execute(sql)

date = RS.Fields("date")

Response.Write date

This is a broken down version, it works, but the results are different.

Im looking at the database using SQL Server and it is showing me

2014-10-05 15:06:00

But when the Response.Write runs, it is displaying it as

10/5/2014 3:06:00 PM

How can i use Response.Write to display it exactly as it is in the database?

Cheers,

È stato utile?

Soluzione

use

sql = "SELECT CONVERT(VARCHAR(19), date, 120) as date FROM sales WHERE userid=1"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top