Guest Posted May 12, 2010 Share Posted May 12, 2010 I have an issue I want to add +7days to order date so: i get the date value DB i cant manage to add 7days now i get: 2010.gads 01.maijs (gads - means year and maijs - means may) but i need: 2010.gads 08.maijs, i`m getting an error Parse error: syntax error, unexpected '(', expecting ')' in /var/www/sapnudarbnica/includes/application_top.php on line 298 function replaceMon3($paydate = date( 'Y-m-d', strtotime( '+7 day', $Orderdp ) )) { // replace English 3 letter month abbreviation with full any languge - month name switch(substr($paydate,8,3)) { case 'Jan': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_JAN; break; case 'Feb': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_FEB; break; case 'Mar': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_MAR; break; case 'Apr': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_APR; break; case 'May': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_MAY; break; case 'Jun': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_JUN; break; case 'Jul': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_JUL; break; case 'Aug': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_AUG; break; case 'Sep': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_SEP; break; case 'Oct': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_OCT; break; case 'Nov': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_NOV; break; case 'Dec': $paydate = substr($paydate,0,4) . YEAR . substr($paydate,4,3) . MONTH_DEC; break; } return $paydate; } this is original function function replaceMon3($Orderdp) { // replace English 3 letter month abbreviation with full Latvian month name switch(substr($Orderdp,8,3)) { case 'Jan': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_JAN; break; case 'Feb': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_FEB; break; case 'Mar': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_MAR; break; case 'Apr': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_APR; break; case 'May': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_MAY; break; case 'Jun': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_JUN; break; case 'Jul': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_JUL; break; case 'Aug': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_AUG; break; case 'Sep': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_SEP; break; case 'Oct': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_OCT; break; case 'Nov': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_NOV; break; case 'Dec': $Orderdp = substr($Orderdp,0,4) . YEAR . substr($Orderdp,4,3) . MONTH_DEC; break; } return $Orderdp; } help! Link to comment Share on other sites More sharing options...
burt Posted May 12, 2010 Share Posted May 12, 2010 http://www.google.com/search?hl=en&safe=off&rlz=1B3GGGL_en___GB242&q=php+add+days+to+date&aq=f&aqi=&aql=&oq=&gs_rfai= should give all the info you need Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2010 Share Posted May 12, 2010 http://www.google.com/search?hl=en&safe=off&rlz=1B3GGGL_en___GB242&q=php+add+days+to+date&aq=f&aqi=&aql=&oq=&gs_rfai= should give all the info you need cant get it work propertly... Link to comment Share on other sites More sharing options...
candycanes Posted May 12, 2010 Share Posted May 12, 2010 cant get it work propertly... Not sure if it matters, but you wrote +7 day not +7 days Other than that, not sure! Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2010 Share Posted May 12, 2010 Not sure if it matters, but you wrote +7 day not +7 days Other than that, not sure! i have managed with this: <?php echo date('Y d M', strtotime("+7 days"));?> to out put current date + 7days, but cannot manage out put date_purchased + 7 days Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2010 Share Posted May 12, 2010 Actually that should look something like this: $orderdp = tep_date_long($order->info['date_purchased'] , strtotime("+7 days")); I`m right? Link to comment Share on other sites More sharing options...
candycanes Posted May 12, 2010 Share Posted May 12, 2010 i have managed with this: <?php echo date('Y d M', strtotime("+7 days"));?> to out put current date + 7days, but cannot manage out put date_purchased + 7 days Try: date('Y d M', strtotime("+7 days", strtotime(&Orderdp))) Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2010 Share Posted May 12, 2010 Try: date('Y d M', strtotime("+7 days", strtotime(&Orderdp))) this: <?php echo date('Y d M', strtotime("+7 days", strtotime($orderdp))) ?> it`s starts to count the days from year 1970 01 Jan and i have displayed - 1970 08 Jan Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2010 Share Posted May 12, 2010 Solved this: if someone needs it here is the solution for +7 days: $orderdp = date('Y d M', ( strtotime($order->info['date_purchased']) +604800 ) ); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.