Sign up to create your own snipts, or login.

Public snipts » hongster's snipts » strtotime The latest strtotime snipts from hongster.

showing 1-2 of 2 snipts for strtotime
  • Determine the earliest business day, taking business hour into consideration.
    <?php
    function next_business_date() {
    	$min = time();
    	
    	// Past cut-off time, make it the next day.
    	if (date('H', $min) >= '17')
    	{
    		$min += 86400; // +24 Hours
    	}
    	
    	// If it falls on weekend, make it Monday.
    	$day_of_week = date('N', $min);
    	if ($day_of_week == '6')
    	{
    		$min += 172800;
    	}
    	elseif ($day_of_week == '7')
    	{
    		$min += 86400;
    	}
    	
    	return strtotime(date('Y-m-d', $min));
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by hongster on Mar 07, 2010 at 11:52 a.m. EST
  • Convert input to MySQL datetime.
    <?php
    date('Y-m-d H:i:s', strtotime($_POST['birthday']));
    ?>
    

    copy | embed

    0 comments - tagged in  posted by hongster on Jul 26, 2009 at 10:10 p.m. EDT
Sign up to create your own snipts, or login.