#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    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
  3. 0x800A0C93
    ASP Super Hero (2500 - 2999 posts)

    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
  4. #3
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    Great! this works! thank you so much!

    Joe

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, 02:39 PM
  2. Replies: 5
    Last Post: March 11th, 2008, 11:09 PM
  3. Date being returned from a time column?
    By baseballdude_ in forum ASP Development
    Replies: 21
    Last Post: December 26th, 2005, 12:54 AM
  4. Converting one format of Datetime to format of date
    By Anitha in forum Microsoft SQL Server
    Replies: 5
    Last Post: May 4th, 2005, 06:08 PM
  5. subtracting 2 hours from date returned
    By aliaga61 in forum SQL Development
    Replies: 0
    Last Post: January 13th, 2004, 02:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo