rossmcm
Programmer
- Jun 28, 2000
- 16
- 0
- 0
I have an access 2000 database that generates asp pages. One of the table fields is a date. If I display:
I get the date in the format: Tue Feb 24 21:39:29 CST 2004
but I want to display the date in short form 24-2-2004 21:39 but If I pass the recordset field to a function like:
I get a runtime error (object expected) on the first line when the function executes.
How can I do this? VB has various functions for formatting dates, but the problem is, it's VB.
Code:
write (RecordSet ("Date")) ;
I get the date in the format: Tue Feb 24 21:39:29 CST 2004
but I want to display the date in short form 24-2-2004 21:39 but If I pass the recordset field to a function like:
Code:
write (FormattedShortDate (RecordSet ("Date"))) ;
function FormattedShortDate (Date)
{
var Hours = Date.getHours () ;
if (Hours < 10)
{
Hours = " " + Hours ;
}
var Minutes = Date.getMinutes () ;
if (Minutes < 10)
{
Minutes = "0" + Minutes ;
}
return (Date.getDate () + "-" + Date.getMonth () + "-" + Date.getYear () + " " +
Hours + ":" + Minutes) ;
}
I get a runtime error (object expected) on the first line when the function executes.
How can I do this? VB has various functions for formatting dates, but the problem is, it's VB.