Format Medium Date   
 

The FormatMediumDate function returns mm/dd/yyyy, unlike (FormatDateTime(Now(),2) which only returns mm/dd/yy.

Syntax:

mediumdate = FormatMediumDate(datevar)
Example Usage:
<% = FormatMediumDate(rs("date")) %>
ASP Source Code:
<%
Function FormatMediumDate(DateValue)
    Dim strYYYY
    Dim strMM
    Dim strDD

        strYYYY = CStr(DatePart("yyyy", DateValue))

        strMM = CStr(DatePart("m", DateValue))
        If Len(strMM) = 1 Then strMM = "0" & strMM

        strDD = CStr(DatePart("d", DateValue))
        If Len(strDD) = 1 Then strDD = "0" & strDD

        FormatMediumDate = strMM & "/" & strDD & "/" & strYYYY

End Function
%>
 
thanks Bubba!


My3C's
perrychicker
It's easy... it's a PSACAKE!
Back | Tell A Friend | Search this Site
© 1998 - 2010 psacake.com
Version 3.23

Send me One Million FREE Guaranteed Visitors