Re: strtotime() logic error Programming Web Development by cereal strtotime($current_time) <= (strtotime($serving_time) - 3600) ) { echo 'red'; } elseif( strtotime($current_time) <= (strtotime($serving_time) - 3300) && strtotime($current_time) >= (strtotime… '."\t". date('G:i:s', strtotime($serving_time) - 3300) . PHP_EOL; echo PHP_EOL;… Re: strtotime() logic error Programming Web Development by Zagga …") && strtotime($current_time) <= strtotime($serving_time)) { echo "red"; } elseif (strtotime($current_time) > strtotime($serving_time) && strtotime($current_time) <= strtotime($serving_time . "… strtotime() logic error Programming Web Development by ehpratah …18:10"; $serving_time="18:05"; if (strtotime($current_time) >= (strtotime($serving_time) - 3600 )) { echo "<tr …td></tr> "; } else if (strtotime($current_time) > (strtotime($serving_time) - 3900 )) { echo "<tr bgcolor… Re: strtotime() logic error Programming Web Development by ehpratah …18:05"; $serving_time="18:00"; if (strtotime($current_time) >= (strtotime($serving_time) - 3600 )) { echo "red"; }… else if (strtotime($current_time) >= (strtotime($serving_time) - 3900 )) { echo "orange "; } else… Re: strtotime() logic error Programming Web Development by cereal If you add an equal sign it will work, but at 18.06 will change to default again. Is this the expected behaviour? else if (strtotime($current_time) >= (strtotime($serving_time) - 3900 )) strtotime bug Programming Web Development by Buppy Hi, I have a problem with strtotime displaying months. See the code: print(date('M-d')); //prints May-31 print(date('M-d',strtotime('-1 month'))); //prints May-01 Since i need it to get the previous month, why is the function ignoring the fact that there are 31 days in May? Thanks Re: strtotime bug Programming Web Development by cereal … the function page: http://www.php.net/manual/en/function.strtotime.php#107331 There is also a note that suggest to… strtotime returns -1 Programming Web Development by crsukla I have php 4.4 version i am getting a strange error here. [CODE] echo strtotime("2009-04-24T20:00:05.000Z"); [/CODE] It is giving result as -1 What is the problem and how to overcome this. I dont have an option for php upgradation. Re: strtotime returns -1 Programming Web Development by somedude3488 That means that your time string is invalid. It can't read it. Have you looked at [url=http://us2.php.net/strtotime]php.net[/url]? Re: strtotime returns -1 Programming Web Development by BzzBee it will work in php5 try this in php4 [CODE] echo strtotime("2009-04-24 20:00:05"); [/CODE] Any more strtotime bugfixes ? Programming Web Development by almostbob everybody knows strtotime is buggy in and around february…$year = date('Y'); $result = strtotime("{$year}-{$mth}-01"); $start = strtotime('-1 second', strtotime('+1 month +1 day', $result)); $…end = strtotime ('-1 second', strtotime('+1 month + 1 year… Re: Compare dates using strtotime Programming Web Development by simplypixie … is interested, I now have $closing_date = strtotime('-7 day', strtotime($show['closing_date'])); $current_date = strtotime('+7 day', strtotime(date('Y-m-d'))); if ($closing_date <… Compare dates using strtotime Programming Web Development by simplypixie … isn't working quite as expected) is: $closing_date = strtotime('-7 day', strtotime($show['closing_date'])); $current_date = strtotime('Y-m-d'); if ($closing_date > $current_date… Re: Date pre-1970, strtotime and safestrtotime nor mktime is of any help Programming Web Development by hbmarar …); $basetime = 0x80000000 + 1570448; } return $basetime + strtotime ($s); } [/CODE] --------------------------Function2-------------------------- [CODE] function safestrtotime…, "1970", $strInput); }; }; $iVal = strtotime($strInput); if ($yearSkew > 0) { $numSecs = … date and strtotime problem Programming Web Development by rogelioz Hi, I have the following code: [code] $date = 'Nov 7, 2007'; echo date('Y-m-d', strtotime($date));//outputs 2007-11-07 $date2 = $dates[1][0]; echo $date2;//outputs Nov 7, 2007 echo date('Y-m-d', strtotime($date2));//outputs 1969-12-31 [/code] How can I have the last line output 2007-11-07? Thanks in advance. Re: date and strtotime problem Programming Web Development by chrelad …;?php $date = 'Nov 7, 2007'; echo date('Y-m-d', strtotime($date)); //$date2 = $dates[1][0]; echo $date2 = 'Nov 7, 2007…'; echo date('Y-m-d', strtotime($date2)); ?> [/CODE] Check the code that sets the $dates… Date pre-1970, strtotime and safestrtotime nor mktime is of any help Programming Web Development by hbmarar …-1970. I tried as strftime("%Y-%m-%d", strtotime(''1-1-1900)). I also tried with mktime but same…. There is a safestrtotime() in the strtotime function page in php.net but that gives me for… php's strtotime() alternate for C# Programming Software Development by snehil_khanor hi, php have thi svery nice function strtoime() int strtotime ( string $time [, int $now ] ) The function expects to be given … is not supplied. [url]http://php.net/manual/en/function.strtotime.php[/url] i was wondering if we have any similar… setcookie + strtotime('tomorrow') give wrong date Programming Web Development by chifliiiii … [CODE]echo date("H:i m/d/Y", strtotime("tomorrow"));[/CODE] i get 00:00 05/19… function in setcookie like: [CODE]setcookie("wls_yesterday_review", 'completed', strtotime('tomorrow'),'/','myhost.com');[/CODE] My cookie will expire on 05… Problems with strtotime Programming Web Development by geaclaesson …? [CODE] $date = "12/13/2011 00:01"; $form_init_date=strtotime($date); $date2 = "12/13/2011 23:59"; $form_end_date…=strtotime($date2); $order = mysql_query("SELECT * FROM orders WHERE WORK='COMPLETED' … Re: php's strtotime() alternate for C# Programming Software Development by kvprajapati [b]>php's strtotime() alternate for C#[/b] Nope! But use the type [B][URL="http://msdn.microsoft.com/en-us/library/system.datetime.aspx"]DateTime[/URL][/B] and its method. Re: Problems with strtotime Programming Web Development by simplypixie What format are you expecting to get from your strtotime and what format are you using in your database for the date columns? Also you original date format should be 13/12/2011 not 12/13/2011. Re: PHP Strtotime Programming Web Development by Biiim …("Y-m-d H:i:s",strtotime("-15 minutes",strtotime(date("Y-m-d H:i:s… PHP Strtotime Programming Web Development by programmer12 … 15mins before Start Time. $reminder = date("g:i", strtotime("-15 minutes", $time1)); //Print echo $reminder; But the… Re: strtotime() logic error Programming Web Development by ehpratah hi i tried putting = sign already but still no luck yes it is better if it will change back to default when the time is 18.06 but even the else statement is not working its always in red color Re: strtotime() logic error Programming Web Development by diafol Remember that php is server-side. So when you enter a new 'zone', the background colour won't change automatically. You probably need javascript to intitiate that, if that's what you need. Re: strtotime() logic error Programming Web Development by ehpratah Hi everyone just got back from a Goodnight sleep. thank you all for the effort and response to my SOS i really appreciate it so much...its working fine now using **Zagga** script..thank you all again:)) Re: strtotime returns -1 Programming Web Development by crsukla The same thing if i test in PHP 5.4.4 or above then it is working fine. Re: strtotime returns -1 Programming Web Development by somedude3488 Its not the version, its the time string. Re: Compare dates using strtotime Programming Web Development by diafol I know you've solved it, but I can't see why this can't be done in the query? I'm assuming closing date in DB is Y-m-d format. Can't you run a query using DATEDIFF? http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_datediff You get the difference in days.