Skip to main content
March 27, 2010
Question

Date format output from Access to ASP

  • March 27, 2010
  • 2 replies
  • 2306 views

I see many have had this problem in the past with no real solution that I've found, but I'll try anyway in case I missed something.

Using MS Access, DW CS3, ASP VBScript.

My Access database date field type is Date/Time with an input mask of 00/00/00;0;_ for a format of 03/27/10 which works fine in the db.  However, the output to my ASP page shows 03/27/2010 when previewed in a browser.  I want the output to match the database - 03/27/10.

My regional settings are correctly set at 03/27/10.  The Bindings window in DW offers many date formats which will not bind -- the binding remains "Selected...None" no matter which format is picked.  If I change my db date field to text, the dates do not sort in proper order.  Any solutions?

This topic has been closed for replies.

2 replies

March 31, 2010

Thank you so much for all your help - you've been a tremendous help to me!

Participating Frequently
March 31, 2010

You're most welcome.


Participating Frequently
March 27, 2010

>My Access database date field type

>is Date/Time with an input mask of  00/00/00;0;

The input mask setting is irrelevent. Date/Time fields are internally stored the same regardless of input mask. AFAIK, ASP/VBscript does not support date output with a 2-digit year. You will need to write a custom funtion.

March 27, 2010

I had a feeling that would be the answer.... okay, more research!  Thanks

Participating Frequently
March 28, 2010

Just use a simple function to convert it:

<%

Function FormatDate(DateToFormat)
    FormatDate = (Left (FormatDateTime (DateToFormat,2), InStrRev(FormatDateTime(DateToFormat,2), "/")) _
     & Right (FormatDateTime (DateToFormat,2), 2) )
End Function

response.Write   FormatDate (Now())


%>