Connecting Tech Pros Worldwide Forums | Help | Site Map

To seperate a date from datetime field

Member
 
Join Date: Apr 2007
Posts: 99
#1: Apr 25 '07
In database the date is saved as 2/26/2007 8:45:38 AM
but while displaying the date in a table,i need to display it as this 2/26/2007
write now in table its displaying as datetime.

i'm using ASP with database MS Access

strSQL = "SELECT ..... Date ..... FROM RFCInfo

Set objRS = objConn.Execute(strSQL)
If not objRS.EOF then
objRS.MoveFirst
Do While Not objRS.EOF
strDate = objRS(1)
<td width="60" style="border-style: solid; border-width: 3" height="19"><%=strDate.ToShortDateString()%>&nbsp; </td>

objRS.MoveNext
Loop

and the error occurs is

Microsoft VBScript runtime error '800a01b6'
Object doesn't support this property or method: 'ToShortDateString'

/admin/currentmonth.asp, line 165


if you have anyidea please let me know.
thanks in advance

Member
 
Join Date: Apr 2007
Posts: 99
#2: Apr 25 '07

re: To seperate a date from datetime field


i got it worked by using this.

<td width="60" style="border-style: solid; border-width: 3" height="19"><%=FormatDateTime(strDate, vbShortDate)%>&nbsp;</td>

see this link if you need more information
http://www.ronshardwebapps.com/tips/jantutorialtimedate.asp

Anyway thanks.
Reply


Similar ASP / Active Server Pages bytes