Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 12: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, 18: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, 14:55
rhs98 rhs98 is offline
Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
Posts: 440
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

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