Gossamer Forum
Home : Products : Gossamer Links : Discussions :

If date question

Quote Reply
If date question
Does anyone know why this does not work?


<%if date_field > '2006-08-07'%>
show my stuff
<%endif%>
Quote Reply
Re: [rascal] If date question In reply to
Not sure on this, but I think it is because the date field has "-" in it.

Try using something like

<%if GT::Date::date_is_smaller($date_field, '2006-08-07)%>

Thats probably not exactly right, but hopefully something close...

- Jonathan
Quote Reply
Re: [jdgamble] If date question In reply to
Thanks Jonathan for your help!

Nothing I tryed worked.
Quote Reply
Re: [rascal] If date question In reply to
What kind of errors are you getting? What is your exact code on what template?

Make sure your date fields are in the right case... Add_Date... Mod_Date

The function only returns true or 1 if the first date is smaller than the second.

Also I forgot to add the extra ' at the end of the if statement...


Code:

<%if GT::Date::date_is_smaller($Add_Date, '2006-08-07')%>
yeah!
<%endif%>

This example should work.

Hope this helps,

- Jonathan
Quote Reply
Re: [jdgamble] If date question In reply to
<%if GT::Date::date_is_greater($Add_Date, '2006-08-07')%>
ok it works
<%endif%>



No errors, but does not work for me. I'm using greater than.

Thanks,
Jonathan
Quote Reply
Re: [rascal] If date question In reply to
The only reason it would not work is if the Add_Date is not greater. This means the the link must have been added after YESTERDAY!

To make sure, try printing the Add_Date otherwise...

Code:

<%if GT::Date::date_is_greater($Add_Date, '2006-08-07')%>
<%Add_Date%> &gt; 2006-08-07
<%else%>
<%Add_Date%> &lt; 2006-08-07
<%endif%>



Good luck,

- Jonathan
Quote Reply
Re: [jdgamble] If date question In reply to
Jonathan,

Thank you so much for the time you spent helping me out, it does work.

I had another <%if...%> along with this one that was causing the problem.

Cool It works like magic!
Quote Reply
Re: [rascal] If date question In reply to
Good to know Wink

- Jonathan