did you migrate your products from VM1.1x to VM2.0.xx?
How it behaves if you create a brand new product? Still random behavior?
Just try it. Create a new product, And by hard coding change the time-period as
+10 minute
And check the website if the NEW label is disappeared after 10 minutes.
strtotime() function that we used converts the date to seconds (to compare)
For instance;
February 6 2013 12:00 AM is converted to something like:
123142352534534 (that kind of thing)
This might be the problem. If your Virtuemart's date is American style, and your server's DATE is European style (or the opposite) this might lead this confusion. (Feb 6 2013 is written as: 2/6/2013 in US standards but it is written as 6/2/2013 in european style.)
You can try to change it by modifying this:
$today = strtotime(date("Y-m-d G:i:s")); //todays date
This is YEAR : MONTH : DAY format
Change it to this:
$today = strtotime(date("Y-d-m G:i:s")); //todays date
It might fix the problem. Just give it a shot.
Also for the testing purpose. See what your website is defining for those VALUES.
Add "echo" in the beginning of these lines, something like:
echo $createddate = strtotime(($product->created_on) . " ".$category_new_timeframe.""); // +1 week can anything you want: +2 week, +1 month, +24 hour so on..
echo $today = strtotime(date("Y-m-d G:i:s"));
And in the website see what your website is printing for those values.
Regards.