Seek function to trim seconds off vbLongTime

Someone has probably written or found a function that would strip the :00 from the end of the string returned by code like:

FormatDateTime(wDate,vbLongTime)
juststeveAsked:
Who is Participating?
 
kingsfan76Commented:
actually the Left() function is more handy:

Left(formatDatetime(time(),vbLongTime),Len(formatDatetime(time(),vbLongTime))-6)

and if you want to keep the "AM/PM":

<%
theTime = formatDatetime(time(),vbLongTime)
response.write Left(theTime,Len(theTime)-6) & Right(theTime,2)
%>
0
 
kingsfan76Commented:
would this work:

Response.Write Mid(formatDatetime(time(),vbLongTime),1,Len(formatDatetime(time(),vbLongTime))-6)

just use the Mid() function.  the logic behind is that there is always 6 characters you want strip from the right (i.e.  "1:45:00 PM"  -->  ":00 PM")
0
 
juststeveAuthor Commented:
Excellent...i find the lower case am/pm looks best:

response.write Left(theTime,Len(theTime)-6) & (Right(theTime,2))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.