Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Problems with date comparison

Quote Reply
Problems with date comparison
Hi,
i define this:

<%set today = GT::Date::date_transform($date, '%dd%.%mm%.%yyyy%', '%yyyy%-%mm%-%dd%')%>

And then i need to compare a date called "draw" in the table Users like this:
When draw is older or equal than today, do this
When draw is earlier than today, do that.
The output of both variables works fine, but when i use logic, this doesnt works:

<%if draw <= today%>do this
<%elseif draw > today%>do that
<%endif%>


It doesnt works, when i use "$today",
it doesnt works, when i change the ">" and "<"...

What i am doing wrong???
And: Are there other possibilities to compare a date with today-date?

Thanks in advance!

Coyu
Quote Reply
Re: [Coyu] Problems with date comparison In reply to
Please try this:

<%set today_gt_draw = GT::Date::date_is_greater($today, $draw)%>
<%set today_lt_draw = GT::Date::date_is_smaller($today, $draw)%>

<%if today_gt_draw%>
Today is greater than Draw
<%elsif today_lt_draw%>
Today is less than Draw
<%else%>
They are the same date
<%endif%>

Hope it helps,

Virginia
Quote Reply
Re: [Virginia] Problems with date comparison In reply to
YESSSSSSSSSS! It works very fine!!! ,-)

Thank you very much!!!!!

Greetings from germany!

Coyu
Quote Reply
Re: [Coyu] Problems with date comparison In reply to
How do I use date comparison for expiring links?
example, listing all links expiring today