note 105145 added to function.date

From: Date: Sat, 30 Jul 2011 04:15:27 +0000
Subject: note 105145 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-182013@lists.php.net to get a copy of this message
con esta funcion determino la hora y fecha que le puedo asignar a un usuario en una cita. Tomando como parametros la fecha y hora dela ultima asignada en una base de datos. <?php function dhcita($fecha,$hora){ $anomesdia = date("Y-m-d", strtotime("+1 days")); $horainicio = $anomesdia.' 08:00:00'; $horafinal = $anomesdia.' 13:00:00'; $horaini = strtotime($horainicio); $horafin = strtotime($horafinal); $fechahora = $fecha.' '.$hora; $fecha = strtotime($fechahora); if ($fecha < $horaini){ $dia = $horaini; }elseif($fecha >= $horaini and $fecha < $horafin){ $fecha = strtotime('+10 minutes',$fecha); if($fecha < $horafin){ $dia = $fecha; }else{ $horaini = strtotime('+1 days',$horaini); $dia = $horaini; } }else while($fecha >= $horaini){ $horaini = strtotime('+1 days',$horaini); $horafin = strtotime('+1 days',$horafin); if($fecha >= $horaini and $fecha < $horafin){ $fecha = strtotime('+10 minutes',$fecha); if($fecha < $horafin){ $dia = $fecha; }else{ $horaini = strtotime('+1 days',$horaini); $dia = $horaini; } break; } } return date('Y-m-d h:i:s a');// la fecha y hora de su cita es 2011-08-01 08:00:00 am } $fh = $dat->consulta('SELECT age_fecha, age_hora FROM agenda ORDER BY age_id DESC LIMIT 1',2); echo 'la fecha y hora de su cita es: ',dhcita($fh[0],$fh[1]); //dhcita('2011-07-31','12:50:00'); ?> ---- Server IP: 130.206.1.5 Probable Submitter: 201.184.176.26 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/105145 Del: integrated -- https://master.php.net/note/delete/105145/integrated Del: useless -- https://master.php.net/note/delete/105145/useless Del: bad code -- https://master.php.net/note/delete/105145/bad+code Del: spam -- https://master.php.net/note/delete/105145/spam Del: non-english -- https://master.php.net/note/delete/105145/non-english Del: in docs -- https://master.php.net/note/delete/105145/in+docs Del: other reasons-- https://master.php.net/note/delete/105145 Reject -- https://master.php.net/note/reject/105145 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182013) next »