mboehler3 Posted June 21, 2010 Share Posted June 21, 2010 Hi, I have a non-dynamic site that I can only update once a month. Some pages have date-sensitive copy, such as "Sign up for our July 9 newsletter." As a result, I have to use logic so copy like that will not show up on July 10. I've been using logic such as this: <% IF Date() <= "7/09/2010" THEN %>Sign up for our July 9 newsletter <% ELSE %> <%END IF %> And it works fine. The problem is when I get to double digit months like October, where I use logic like this: <% IF Date() <= "10/09/2010" THEN %>Sign up for our October 9 newsletter <% ELSE %> <%END IF %> For some reason, no code appears when I use this logic. Is there a problem with double digit months that causes this logic to break? Any help is appreciated, thanks. Link to comment Share on other sites More sharing options...
wirehopper Posted June 22, 2010 Share Posted June 22, 2010 Date() returns a date, "7/09/2010" is a string.You need to find an ASP function that accepts a string and returns a date for comparison. Check DateDiff or DateCompare. Link to comment Share on other sites More sharing options...
NurAzije Posted June 22, 2010 Share Posted June 22, 2010 Try this:http://bytes.com/topic/asp-classic/answers...ld-current-date Link to comment Share on other sites More sharing options...
mboehler3 Posted June 22, 2010 Author Share Posted June 22, 2010 Thanks for the link.When I try using this code: <% IF DateDiff ("d", Date(), #01/07/2010#) > 0 THEN %> it doesn't work properly (I substituted 01/07/2010 with 06/21/2010). is there something i'm missing? Date() returns a date, "7/09/2010" is a string.You need to find an ASP function that accepts a string and returns a date for comparison. Check DateDiff or DateCompare. Link to comment Share on other sites More sharing options...
mboehler3 Posted June 22, 2010 Author Share Posted June 22, 2010 Nevermind, I needed to switch the month and date. Thanks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.