Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Time based functions

$
0
0

Heya guys! I'm using an open source platform called Ubercart which works with PHP and I've implemented the following code. Essentially I'm working towards dynamically changing the price of product after a certain time.

 

$dtA = new DateTime('01/15/2014 2:15PM');
 
if ( time() > $dtA ) {
  $item->price = $2.00;
}
else {
  $item->price = $item->price;
}
 
Problem is it doesn't work. In this instance I simply want the price of this item to be $2 if the current time has past '01/15/2014 2:15PM', which it has. Any guidance would be much appreciated. 

Viewing all articles
Browse latest Browse all 13200

Trending Articles