...

View Full Version : Resolved date comparison not working.



bazz
11-21-2009, 06:29 AM
Hi,

too tired. I forgot to convert from iso date formats.


I am looping through some dates and making a comparison, in order to generate a variable value. the comparison isn't working properly and I can't seem to work it out.



for info:
tariff_start='2009-10-01';
tariff_end = '2010-03-31';
currdate= '2009-04-01';


my $tariff_status = 'no_tariff';

if ($currdate >= $tariff_start && $currdate <= $tariff_end){
$tariff_status = 'has_tariff';
print qq( ts=$tariff_start : te=$tariff_end : cd=$currdate : ts=$tariff_status <br /> );


That lot outputs

ts=2009-10-01 : te=2010-03-31 : cd=2009-04-01 ts=has_tariff

It should be telling me there is no_tariff :confused:
Can you see what I am overlooking?

bazz



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum