Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Format Date Returned from MS SQL

Results 1 to 3 of 3
Share This Thread →
  1. #1
    joesmithf1 is offline Registered User
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Format Date Returned from MS SQL

    Hello Everyone,


    I am trying to format a date value on my ASP pages, returned from MS SQL. One of my SQL field(status_dt), has a datatype of “datetime.” I created an ASP page to pull in this date, and it is displayed in the format of mm/dd/yyyy. However, how can I have it displayed as, November, 2012?

    I found an ASP function(DateTime.Now.ToString("Y")) that does this, but as you can see, it is using the current’s system date. I tried plugging my Status_Dt field into the code, but apparently it is not working. Please help!

    I tried this with my field, but no luck.
    <%response.write DateTime.rstemp("status_dt").ToString("Y")%>

    Thank you.
    Joe

  2. #2
    bigmike1212's Avatar
    bigmike1212 is offline 0x800A0C93
    Join Date
    Jan 2009
    Location
    Ridin' through this world...
    Posts
    2,975
    Rep Power
    1310
    VBScript Functions

    d= rstemp("status_dt")
    d= CDate(d)
    response.write monthname(month(d)) & ", " & year(d) & "<br>"
    Brinkster- free development account. Not affiliated, but I sure like free. Brinkster.com

  3. #3
    joesmithf1 is offline Registered User
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    Great! this works! thank you so much!

    Joe

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Remove time from Date with Format. Lost ability to filter by date
    By volvagia720 in forum Microsoft Access Help
    Replies: 2
    Last Post: November 4th, 2012, 01:39 PM
  2. Replies: 5
    Last Post: March 11th, 2008, 10:09 PM
  3. Date being returned from a time column?
    By baseballdude_ in forum ASP Development
    Replies: 21
    Last Post: December 25th, 2005, 11:54 PM
  4. Converting one format of Datetime to format of date
    By Anitha in forum Microsoft SQL Server
    Replies: 5
    Last Post: May 4th, 2005, 05:08 PM
  5. subtracting 2 hours from date returned
    By aliaga61 in forum SQL Development
    Replies: 0
    Last Post: January 13th, 2004, 01:41 PM

ASP Free Advertisers and Affiliates