Formatting Time

S

Scott

I have a datetime field that looks like 7/24/2004 8:45:00 AM

I just want to display 8:45 AM

<%= FormatDateTime(Now, 3 )%> returns: 8:45:00 AM

Any idea how to get rid of seconds?
 
S

SPD

Here's one option:

<%
Function DisplayTime(thisTime)
Dim strTime
strTime = FormatDateTime(thisTime, 3)
DisplayTime = Left(strTime, InStrRev(strTime, ":")-1) & Right(strTime, 3)
End Function


Response.Write DisplayTime("7/24/2004 8:45:00 AM") %>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,416
Latest member
LionelQ387

Latest Threads

Top