If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Can't get ASP to read date and time from SQL Server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-22-03, 11:19
Bigced_21 Bigced_21 is offline
Registered User
 
Join Date: Dec 2002
Location: KY
Posts: 54
Angry 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
Reply With Quote
  #2 (permalink)  
Old 04-22-03, 17:42
MrWizard MrWizard is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 04-24-03, 13:55
rhs98 rhs98 is offline
Super Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On