Categories > TinyButStrong general >

How can we compare dates in conditional blocks ?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: octal
Date: 2006-08-11
Time: 23:38

How can we compare dates in conditional blocks ?

in conditional blocks there are some operators to compare numbers like
==  , != , +- .... how can we compare dates ?
I have a block like that
<div class="NewsTitle">[newsitem.TITLE]<img src=[newsitem.DATEPUB;frm='mmm dd, yyyy';if [val]!=[var..now;frm='mmm dd, yyyy'];then '"/images/news.gif"';else '"/images/news_new.gif"'] ></div>

this block uses conditional to check the date in order to choose the correct icon for a News publisher. If the date is old it returns normal icon, if it"s today or tomorrow it shows a bright news icon. How can we compare dates (before or after ...)
Best regards and THANK YOU VERY WELL FOR THIS GREAT TEMPLATE ENGINE
By: Skrol29
Date: 2006-08-14
Time: 17:22

Re: How can we compare dates in conditional blocks ?

Hi Octal,

TBS comparaisons don't work for dates. They are very simple because any subtile comparaison should be prepared into the PHP side.
For exemple, you can prepare the info in a calculated column in your SQL statement. Or you can add a calculated column computed using parameter "ondata".
By: octal
Date: 2006-08-14
Time: 17:37

Re: How can we compare dates in conditional blocks ?

Ok thank you Scrol29. I have effectively solved the problem using SQL date diff calculations.
Thank you very much.
Best regards
Octal