shadiadiph Posted April 14, 2009 Share Posted April 14, 2009 I have been trying to make some times maybe i am just too tired but i can't figure out why this is producing errors?? $todaysdate = date('Y-m-d'); $todaysdateintime = strtotime($todaysdate); $1days = "$todaysdateintime - 86400"; $3days = "$todaysdateintime - 259200"; $7days = "$todaysdateintime - 604800"; $14days = "$todaysdateintime - 1209600"; $21days = "$todaysdateintime - 1814800"; $30days = "$todaysdateintime - 2592000"; $1day = date('Y-m-d',$1days); $3day = date('Y-m-d',$3days); $7day = date('Y-m-d',$7days); $14day = date('Y-m-d',$14days); $21day = date('Y-m-d',$21days); $30day = date('Y-m-d',$30days); Link to comment https://forums.phpfreaks.com/topic/154033-solved-making-time-not-working/ Share on other sites More sharing options...
MasterACE14 Posted April 14, 2009 Share Posted April 14, 2009 what are the errors? Link to comment https://forums.phpfreaks.com/topic/154033-solved-making-time-not-working/#findComment-809694 Share on other sites More sharing options...
shadiadiph Posted April 14, 2009 Author Share Posted April 14, 2009 Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' this is on line $1days Link to comment https://forums.phpfreaks.com/topic/154033-solved-making-time-not-working/#findComment-809695 Share on other sites More sharing options...
MasterACE14 Posted April 14, 2009 Share Posted April 14, 2009 lol I could of just read your script change this... <?php $1days = "$todaysdateintime - 86400"; $3days = "$todaysdateintime - 259200"; $7days = "$todaysdateintime - 604800"; $14days = "$todaysdateintime - 1209600"; $21days = "$todaysdateintime - 1814800"; $30days = "$todaysdateintime - 2592000"; to this... <?php $days1 = $todaysdateintime - 86400; $days3 = $todaysdateintime - 259200; $days7 = $todaysdateintime - 604800; $days14 = $todaysdateintime - 1209600; $days21 = $todaysdateintime - 1814800; $days30 = $todaysdateintime - 2592000; variables can't start with a number, and wrapping those double quotes " " around its value with the numbers on the end makes it think it is a string(text) instead of 2 numbers subtracting. Link to comment https://forums.phpfreaks.com/topic/154033-solved-making-time-not-working/#findComment-809699 Share on other sites More sharing options...
shadiadiph Posted April 14, 2009 Author Share Posted April 14, 2009 mm same error thanks for trying though Link to comment https://forums.phpfreaks.com/topic/154033-solved-making-time-not-working/#findComment-809702 Share on other sites More sharing options...
MasterACE14 Posted April 14, 2009 Share Posted April 14, 2009 gotta change these too... <?php $day1 = date('Y-m-d',$days1); $day3 = date('Y-m-d',$days3); $day7 = date('Y-m-d',$days7); $day14 = date('Y-m-d',$days14); $day21 = date('Y-m-d',$days21); $day30 = date('Y-m-d',$days30); Link to comment https://forums.phpfreaks.com/topic/154033-solved-making-time-not-working/#findComment-809703 Share on other sites More sharing options...
shadiadiph Posted April 14, 2009 Author Share Posted April 14, 2009 it was producing the same error on the same line but this seems to work $todaysdate = date('Y-m-d'); $todaysdateintime = strtotime($todaysdate); $oneday = $todaysdateintime - 86400; $threeday = $todaysdateintime - 259200; $sevenday = $todaysdateintime - 604800; $fourteenday = $todaysdateintime - 1209600; $twentyoneday = $todaysdateintime - 1814800; $thirtyday = $todaysdateintime - 2592000; $onedays = date('Y-m-d',$oneday); $threedays = date('Y-m-d',$threeday); $sevendays = date('Y-m-d',$sevenday); $fourteendays = date('Y-m-d',$fourteenday); $twentyonedays = date('Y-m-d',$twentyoneday); $thirtydays = date('Y-m-d',$thirtyday); thanks for the help Link to comment https://forums.phpfreaks.com/topic/154033-solved-making-time-not-working/#findComment-809760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.