Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    KY
    Posts
    56

    Angry Unanswered: Can't get ASP to read date and time from SQL Server

    what i'm trying to do is display
    2003-2004
    using this <% =Year(strDate) ' - ' =Year(strDate) + 1 %>
    but i can't get ASP to read the date and time from SQL Server

  2. #2
    Join Date
    Mar 2003
    Location
    Atlanta, GA
    Posts
    191

    ok... i give up...

    What code are you using to get the date?

    <% =Year(strDate) ' - ' =Year(strDate) + 1 %>

    strDate is a string variable you created... I assume you put the date in it somewhere else?

    If not, try the Date function...

    ie: <% =Year(Date) & ' - ' & Year(Date) + 1 %>

    Otherwise, I must be missing something.


    Tim
    Tim

  3. #3
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    the year function has a date as an input. I am guessing (from the one line of code you gave) that your trying to use it with a String returned from a recordset...

    Either do what MrWizzard says which will get the server time, not the time from that string (which is probably what you want) or;

    you will need to convert the string into a date using a string to date formatting function. For info on how to do it read here (in the Date/Time Functions (VBScript) section);
    http://www.w3schools.com/asp/asp_examples.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •