Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date format for ASP page

Status
Not open for further replies.

tamnet

IS-IT--Management
Jun 2, 2005
31
GB
HI,
I have a asp page with a form that submits data to an access DB in the form i have a date field which is foramtted as dd/mm/yy using the following 2 functions

Code:
<%
Function Pad(strText, nLen, strChar, bFront)
    Dim nStartLen
    
    If strChar = "" Then 
        strChar = "0"
    End If
    nStartLen = Len(strText)
    If Len(strText) >= nLen Then
        Pad = strText
    Else
        If bFront Then
            Pad = String(nLen - Len(strText), strChar) & strText
        Else
            Pad = strText & String(nLen - Len(strText), strChar)
        End If
    End If
End Function
%>

<% '***Start Function strUKDate
Dim strUKDate, MYdd, MYmm, MYyy
MYdd = DatePart("d", date())
MYmm = DatePart("m", date())
MYyy = DatePart("yyyy", date())
strUKDate = (Pad(MYdd,2,"0", True) &"/"& Pad(MYmm,2,"0", True)  &"/"&right(MYyy,2))
'***End Function strUKDate
%>

[COLOR=red]Then this is my textfield code[/color]

<input name="txtSdate" type="text" id="txtSdate" value="<%=strUKdate%>" size="10" maxlength="10" readonly="true">

When the date is stored in the DB it is shown as dd/mm/yyyy

I then display the date in another ASP page from a recordset but i would really like it shown as dd/mm/yy

I have tried using the following
Code:
<%=FormatDateTime((RSAlldetails.Fields.Item("Start_Date").Value),vbShortDate)%>

but this still displays as dd/mm/yyyy, is there any way i can get my desired format or am i stuck with what i have ?

any help appreciated

Thanks
Paul

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top