Stefan Motz
asked on
Is there a way to format the vbLongTime without displaying the seconds?
The code below returns the time from SQL Server database.
<%=FormatDateTime(rs("Time Completed" ),vbLongTi me)%>
I get: 12:47:00 PM
I would like: 12:47 PM
Thanks for your help.
<%=FormatDateTime(rs("Time
I get: 12:47:00 PM
I would like: 12:47 PM
Thanks for your help.
ASKER
I've tried it and this is the error I get:
Object doesn't support this property or method: 'toString'
Maybe because my page is written in Classic ASP
Object doesn't support this property or method: 'toString'
Maybe because my page is written in Classic ASP
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I suppose if you included the trailing space in the replace, you'd be fine:
replace(FormatDateTime(rs( "TimeCompl eted"),vbL ongTime)," :00 "," ")
But it would only work if you always had 00 seconds in your field as om_prakash_p mentioned.
replace(FormatDateTime(rs(
But it would only work if you always had 00 seconds in your field as om_prakash_p mentioned.
In classic asp then I think just format(string,"HH:MM") works well.
ASKER
Both methods work for me, thank you very much for your help.
The seconds are always 00, so I don't need to display them
The seconds are always 00, so I don't need to display them
See this for vb6 style format that should work with classic asp
http://www.vb6.us/tutorials/formating-dates-and-times-vb6
http://www.vb6.us/tutorials/formating-dates-and-times-vb6
Ok I was way off.
http://classicasp.aspfaq.com/date-time-routines-manipulation/can-i-make-vbscript-format-dates-for-me.html
It has been a while but here is one method.
http://classicasp.aspfaq.com/date-time-routines-manipulation/can-i-make-vbscript-format-dates-for-me.html
It has been a while but here is one method.
rs("TimeCompleted").toStri