本文整理汇总了PHP中jddayofweek函数的典型用法代码示例。如果您正苦于以下问题:PHP jddayofweek函数的具体用法?PHP jddayofweek怎么用?PHP jddayofweek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jddayofweek函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getweekday
function getweekday($params)
{
$params_thang_nam = explode('/', $params);
$params = $params_thang_nam[0];
$thang = $params_thang_nam[1];
$nam = $params_thang_nam[2];
$jd = cal_to_jd(CAL_GREGORIAN, $thang, $params, $nam);
$day = jddayofweek($jd, 0);
switch ($day) {
case 0:
$thu = "Chủ nhật";
break;
case 1:
$thu = "Thứ hai";
break;
case 2:
$thu = "Thứ ba";
break;
case 3:
$thu = "Thứ tư";
break;
case 4:
$thu = "Thứ năm";
break;
case 5:
$thu = "Thứ sáu";
break;
case 6:
$thu = "Thứ bảy";
break;
}
return $thu;
}
示例2: __construct
function __construct($month = null, $year = null)
{
$this->month = $month | date('n');
$this->year = $year | date('Y');
$this->dim = cal_days_in_month(CAL_GREGORIAN, $this->month, $this->year);
$this->msw = jddayofweek(cal_to_jd(CAL_GREGORIAN, $this->month, 1, $this->year));
}
示例3: incrementViewCount
private function incrementViewCount($id)
{
$this->Post->updateAll(array('Post.viewed' => 'Post.viewed+1'), array('Post.id' => $id));
$this->loadModel('PostTrend');
$day = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d"), date("Y")), 1);
$this->PostTrend->updateAll(array('PostTrend.' . $day => 'PostTrend.' . $day . '+1'), array('PostTrend.post_id' => $id));
}
示例4: calculateDOW
function calculateDOW($input)
{
$int_date = $this->formatDate($input);
if ($int_date) {
return jddayofweek($int_date, 1);
} else {
return "Invalid Date";
}
}
示例5: getWeekday
function getWeekday($user_input)
{
//Converts user input to array
$date = explode("/", $user_input);
//Insert array to appropriate are to format to julian day
$jul_date = cal_to_jd(CAL_GREGORIAN, (int) $date[0], (int) $date[1], (int) $date[2]);
//Whats the date?
$output = jddayofweek($jul_date, 1);
return $output;
}
示例6: executeCargarReservaciones
public function executeCargarReservaciones(sfWebRequest $request)
{
date_default_timezone_set("America/Guayaquil");
$dia = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d"), date("Y")), 0);
// $tDesde=time()-600;
// $tHasta=time()-540;
// $hDesde=date('H:i:s',$tDesde);
// $hHasta=date('H:i:s',$tHasta);
switch ($dia) {
case '1':
$reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.lunes=?', true)->execute();
break;
case '2':
$reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.martes=?', true)->execute();
break;
case '3':
$reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.miercoles=?', true)->execute();
break;
case '4':
$reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.jueves=?', true)->execute();
break;
case '5':
$reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.viernes=?', true)->execute();
break;
case '6':
$reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.sabado=?', true)->execute();
break;
case '0':
$reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.domingo=?', true)->execute();
break;
default:
break;
}
$dataJson = array();
foreach ($reservacion as $reser) {
if ($reser->getHorario1()) {
if (Operaciones::esHoraReservacion($reser->getHorario1(), date('H:i:s'))) {
$dataJson[] = array('id' => $reser->getId(), 'barrio' => $reser->getCodigo()->getSector()->getNombre(), 'calle1' => $reser->getCodigo()->getCalle1(), 'calle2' => $reser->getCodigo()->getCalle2(), 'cliente' => $reser->getCodigo()->getNombreCliente(), 'hora' => $reser->getHorario1(), 'codigo' => $reser->getCodigo()->getNumero(), 'idcodigo' => $reser->getCodigo()->getId(), 'idsector' => $reser->getCodigo()->getBarrio(), 'latitud' => $reser->getCodigo()->getLatitud(), 'longitud' => $reser->getCodigo()->getLongitud(), 'referencia' => $reser->getCodigo()->getObservacion());
}
}
if ($reser->getHorario2()) {
if (Operaciones::esHoraReservacion($reser->getHorario2(), date('H:i:s'))) {
$dataJson[] = array('id' => $reser->getId(), 'barrio' => $reser->getCodigo()->getSector()->getNombre(), 'calle1' => $reser->getCodigo()->getCalle1(), 'calle2' => $reser->getCodigo()->getCalle2(), 'cliente' => $reser->getCodigo()->getNombreCliente(), 'hora' => $reser->getHorario2(), 'codigo' => $reser->getCodigo()->getNumero(), 'idcodigo' => $reser->getCodigo()->getId(), 'idsector' => $reser->getCodigo()->getBarrio(), 'latitud' => $reser->getCodigo()->getLatitud(), 'longitud' => $reser->getCodigo()->getLongitud(), 'referencia' => $reser->getCodigo()->getObservacion());
}
}
if ($reser->getHorario3()) {
if (Operaciones::esHoraReservacion($reser->getHorario3(), date('H:i:s'))) {
$dataJson[] = array('id' => $reser->getId(), 'barrio' => $reser->getCodigo()->getSector()->getNombre(), 'calle1' => $reser->getCodigo()->getCalle1(), 'calle2' => $reser->getCodigo()->getCalle2(), 'cliente' => $reser->getCodigo()->getNombreCliente(), 'hora' => $reser->getHorario3(), 'codigo' => $reser->getCodigo()->getNumero(), 'idcodigo' => $reser->getCodigo()->getId(), 'idsector' => $reser->getCodigo()->getBarrio(), 'latitud' => $reser->getCodigo()->getLatitud(), 'longitud' => $reser->getCodigo()->getLongitud(), 'referencia' => $reser->getCodigo()->getObservacion());
}
}
}
return $this->renderText(json_encode($dataJson));
}
示例7: checkCalendar
function checkCalendar($date)
{
//Explodes input string into array.
$straight_date = explode('-', $date);
//Converts array into Julian Day number.
$jd_date = cal_to_jd(CAL_GREGORIAN, $straight_date[1], $straight_date[2], $straight_date[0]);
//Converts Julian Day into day of week.
$day_of_week = jddayofweek($jd_date, 1);
if ($day_of_week == "Monday") {
return $day_of_week . "; that sucks!";
} else {
return $day_of_week;
}
}
示例8: buscarPromo
public static function buscarPromo($codigo_plan)
{
$fecha_compra = Formatos::fechaHoraActual();
$codigo_comercio = Persona::numeroComercio();
$dia_semana = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d"), date("Y")));
$empresa = 1;
$sucursal = 1;
$sql = "\n\t\t\t\tSELECT TOP 1\n\t\t\t\t\t tarjetas_planes_promocion.nombre_plan as nombre,\n\t\t\t\t\t tarjetas_planes_promocion.vigencia_hasta as vencimiento\n\t\t\t\t FROM tarjetas_planes_promocion\n\t\t\t\t WHERE nro_empresa = {$empresa}\n\t\t\t\t\tAND nro_sucursal = {$sucursal}\n\t\t\t\t\tAND tarjetas_planes_promocion.codigo_plan = {$codigo_plan}\n\t\t\t\t\tAND Isnull( comercios_todos, 0 ) = 1\n\t\t\t\t\tAND (( IsNull( domingo\t, 0 ) \t= 1 AND 1 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( lunes\t, 0 ) \t= 1 AND 2 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( martes\t, 0 ) \t= 1 AND 3 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( miercoles, 0 ) \t= 1 AND 4 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( jueves\t, 0 ) \t= 1 AND 5 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( viernes\t, 0 ) \t= 1 AND 6 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( sabado\t, 0 ) \t= 1 AND 7 = {$dia_semana} ) ) \n\t\t\t\t\tAND vigencia_desde <= '{$fecha_compra}'\n\t\t\t\t\tAND vigencia_hasta >= '{$fecha_compra}'\n\t\t\t\t\tAND isnull(habilitado,0) = 1\n\n\t\t\t\tUNION ALL\n\n\t\t\t\tSELECT\n\t\t\t\t\t tarjetas_planes_promocion.nombre_plan AS nombre,\n\t\t\t\t\t tarjetas_planes_promocion.vigencia_hasta AS vencimiento\n\n\t\t\t\t FROM tarjetas_planes_comercios\n\t\t\t\t JOIN tarjetas_planes_promocion ON\n\t\t\t\t\t\t( tarjetas_planes_comercios.nro_empresa \t = tarjetas_planes_promocion.nro_empresa AND\n\t\t\t\t\t\t tarjetas_planes_comercios.nro_sucursal \t = tarjetas_planes_promocion.nro_sucursal \t AND\n\t\t\t\t\t\t tarjetas_planes_comercios.codigo_plan \t = tarjetas_planes_promocion.codigo_plan \t AND\n\t\t\t\t\t\t tarjetas_planes_comercios.vigencia_desde = tarjetas_planes_promocion.vigencia_desde AND\n\t\t\t\t\t\t tarjetas_planes_comercios.cod_promocion\t = tarjetas_planes_promocion.cod_promocion\t )\n\n\t\t\t\t WHERE tarjetas_planes_comercios.nro_empresa \t\t= {$empresa}\n\t\t\t\t\tAND tarjetas_planes_comercios.nro_sucursal \t\t= {$sucursal}\n\t\t\t\t\tAND tarjetas_planes_comercios.codigo_comercio \t= {$codigo_comercio}\n\n\t\t\t\t\tAND tarjetas_planes_comercios.codigo_plan \t\t= {$codigo_plan}\n\t\t\t\t\tAND (( IsNull( tarjetas_planes_promocion.domingo\t, 0 ) = 1 AND 1 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( tarjetas_planes_promocion.lunes\t\t, 0 ) = 1 AND 2 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( tarjetas_planes_promocion.martes\t, 0 ) = 1 AND 3 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( tarjetas_planes_promocion.miercoles\t, 0 ) = 1 AND 4 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( tarjetas_planes_promocion.jueves\t, 0 ) = 1 AND 5 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( tarjetas_planes_promocion.viernes\t, 0 ) = 1 AND 6 = {$dia_semana} ) or \n\t\t\t\t\t\t ( IsNull( tarjetas_planes_promocion.sabado\t, 0 ) = 1 AND 7 = {$dia_semana} ) ) \n\n\t\t\t\t\tAND tarjetas_planes_comercios.vigencia_desde <= '{$fecha_compra}'\n\t\t\t\t\tAND tarjetas_planes_comercios.vigencia_hasta >= '{$fecha_compra}'\n\t\t\t\t\tAND isnull(tarjetas_planes_comercios.habilitado,0) = 1\n\t\t\t\t AND isnull(tarjetas_planes_promocion.habilitado,0) = 1\n\t\t";
$datos = DB::select($sql);
if (count($datos) <= 0) {
return 'no hay';
}
return $datos;
}
示例9: contains
public function contains(\DateTime $dateTime)
{
$value = ($this->day < 0) ? -1 : 1;
$compare = clone $dateTime();
$dayOfWeek = jddayofweek(cal_to_jd(CAL_GREGORIAN,
$dateTime->format('m'),
$dateTime->format('j'),
$dateTime->format('Y')));
return ($this->day == $dayOfWeek) &&
($compare->add((-1 * $this->day) . ' days')->format('m') != $dateTime->format('m')) &&
($compare->setDate($dateTime->getTimestamp())->add((-1 * $this->day) + $value)->format('m') == $dateTime->format('m'));
}
示例10: contains
public function contains(\DateTime $dateTime)
{
if ($this->ignoreDay) {
if ($this->day > 0) {
return $dateTime->format('j') == $this->day;
} else {
$calendarDays = cal_days_in_month(CAL_GREGORIAN, $dateTime->format('Y'), $dateTime->format('m'));
return $calendarDays + 1 + $this->day === $dateTime->format('j');
}
} else {
$value = $this->day < 0 ? -1 : 1;
$compare = clone $dateTime();
$dayOfWeek = jddayofweek(cal_to_jd(CAL_GREGORIAN, $dateTime->format('m'), $dateTime->format('j'), $dateTime->format('Y')));
return $this->day == $dayOfWeek && $compare->add(-1 * $this->day . ' days')->format('m') != $dateTime->format('m') && $compare->setDate($dateTime->getTimestamp())->add(-1 * $this->day + $value)->format('m') == $dateTime->format('m');
}
}
示例11: index
public function index()
{
$year = date("Y", time());
$month = date("n", time());
$day = date("j", time());
$noOfThisWeek = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d"), date("Y")), 0);
if ($noOfThisWeek == 0) {
$noOfThisWeek = 7;
}
$plus = 7 - $numOfday;
$by = $noOfThisWeek - 1;
$today_beginSec = mktime(0, 0, 0, $month, $day, $year);
$today_lastSec = mktime(24, 0, 0, $month, $day, $year);
$yestday_beginSec = mktime(0, 0, 0, $month, $day - 1, $year);
$yestday_lastSec = mktime(24, 0, 0, $month, $day - 1, $year);
$this_week_beginSec = mktime(0, 0, 0, $month, $day - $by, $year);
$this_week_endSec = mktime(24, 0, 0, $month, $day + $plus, $year);
$this_month_beginSec = mktime(0, 0, 0, $month, 1, $year);
$this_month_endSec = mktime(0, 0, 0, $month + 1, 1, $year);
$this_year_beginSec = mktime(0, 0, 0, 1, 1, $year);
$this_year_endSec = mktime(0, 0, 0, 1, 1, $year + 1);
$Inqueue = M("Inqueue");
$Okin = M("Okin");
$results_inqueue = $Inqueue->select();
$results_okin_today = $Okin->where("`out_time` > {$today_beginSec} AND `out_time` < {$today_lastSec}")->select();
$results_okin_yestoday = $Okin->where("`out_time` > {$yestday_beginSec} AND `out_time` < {$yestday_lastSec}")->select();
$results_okin_this_week = $Okin->field('user_numb,user_name,sum(delay_time),avg(delay_time),count(user_numb)')->group('user_numb')->where("`out_time` > {$this_week_beginSec} AND `out_time` < {$this_week_endSec}")->select();
$results_okin_this_month = $Okin->field('user_numb,user_name,sum(delay_time),avg(delay_time),count(user_numb)')->group('user_numb')->where("`out_time` > {$this_month_beginSec} AND `out_time` < {$this_month_endSec}")->select();
$results_okin_this_year = $Okin->field('user_numb,user_name,sum(delay_time),avg(delay_time),count(user_numb)')->group('user_numb')->where("`out_time` > {$this_year_beginSec} AND `out_time` < {$this_year_endSec}")->select();
//var_dump($results_okin_this_month);
$this->assign('title', '签到统计');
$this->assign('results_inqueue', $results_inqueue);
$this->assign('results_okin_today', $results_okin_today);
$this->assign('results_okin_yestoday', $results_okin_yestoday);
$this->assign('results_okin_this_week', $results_okin_this_week);
$this->assign('results_okin_this_month', $results_okin_this_month);
$this->assign('results_okin_this_year', $results_okin_this_year);
$this->display('index');
}
示例12: render
/**
* render calendar called in view via helper
* @param mixed $date
* @param Array $options
*/
public function render($date = null, $options = array())
{
$calendar = $this->parsed($date);
$this->buildConfig($options);
$container = new DomBuilder('div', array('id' => $this->style['div']));
for ($month = 0; $month < $this->displayedMonth; $month++) {
$monthDays = cal_days_in_month(CAL_GREGORIAN, $calendar->format('n'), $calendar->format('Y'));
if ($calendar->format('j') != 1) {
$calendar->sub(new \DateInterval("P{$calendar->format('j')}D"))->add(new \DateInterval("P1D"));
}
$firstDay = $calendar->format('N');
$weeks = ceil(($monthDays + $firstDay) / 7);
$table = new DomBuilder('table', array('class' => $this->style['table']));
$th = $table->addChild('thead')->addChild('tr', array('class' => $this->style['title']))->addChild('th', array('colspan' => 7, 'class' => $this->style['title']));
$th->content = $calendar->format('F Y');
$days = $table->get('thead')->addChild('tr');
for ($day = 0; $day < 7; $day++) {
$cell = $days->addChild('th');
$cell->content = $this->abbreviate ? jddayofweek($day, 2) : jddayofweek($day, 1);
}
for ($week = 0; $week < $weeks; $week++) {
$weekdate = $table->addChild('tr');
for ($day = 0; $day < 7; $day++) {
$cellNumber = $week * 7 + $day;
$class = $calendar->format('d-m-Y') == date('d-m-Y') ? $this->style['current'] : null;
$cell = $weekdate->addChild('td', array('class' => $class));
if ($cellNumber + 1 >= $firstDay && $cellNumber + 1 < $monthDays + $firstDay) {
$cell->content = $this->renderCell($calendar);
$calendar->add(new \DateInterval("P1D"));
}
}
}
$container->addChild($table);
}
return $container->render();
}
示例13: mktime
<?php
$nombre = "ayer.html";
$ayer = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$today = date('Ymd', $ayer);
$dayweek = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d") - 1, date("Y")), 0);
include 'include.php';
?>
示例14: getWeekDays
/**
* Given a string representation of a set of weekdays, returns an array of
* possible dates.
*/
function getWeekDays($str, $month, $year)
{
$daysInMonth = $this->daysinmonth($month, $year);
if (strstr($str, ",")) {
$tmp1 = explode(",", $str);
$count = count($tmp1);
for ($i = 0; $i < $count; $i++) {
//Loop through each comma-separated value
if (strstr($tmp1[$i], "-")) {
//If there's a range in this place, expand that too
$tmp2 = explode("-", $tmp1[$i]);
for ($j = $start; $j <= $tmp2[1]; $j++) {
for ($n = 1; $n <= $daysInMonth; $n++) {
if ($j == jddayofweek(gregoriantojd($month, $n, $year), 0)) {
$ret[] = $n;
}
}
}
} else {
//Otherwise, just add the value
for ($n = 1; $n <= $daysInMonth; $n++) {
if ($tmp1[$i] == jddayofweek(gregoriantojd($month, $n, $year), 0)) {
$ret[] = $n;
}
}
}
}
} else {
if (strstr($str, "-")) {
//There might only be a range, no comma sep values at all. Just loop these
$range = explode("-", $str);
for ($i = $start; $i <= $range[1]; $i++) {
for ($n = 1; $n <= $daysInMonth; $n++) {
if ($i == jddayofweek(gregoriantojd($month, $n, $year), 0)) {
$ret[] = $n;
}
}
}
} else {
//Otherwise, it's a single value
for ($n = 1; $n <= $daysInMonth; $n++) {
if ($str == jddayofweek(gregoriantojd($month, $n, $year), 0)) {
$ret[] = $n;
}
}
}
}
return $ret;
}
示例15: strtotime
$tiempo_alquiler=$miconexion->consulta_lista();
$Hora = strtotime($_POST['hora_partido']) + (60 *60 * $tiempo_alquiler[0]);
$hora_fin = "".date('H:i:s',$Hora);
$centro = $_POST['id_centro'];
$fecha_partido = $_POST['fecha_partido'];
$hora_partido = $_POST['hora_partido'];
$sql = 'select count(*) from partidos where id_centro="'.$centro.'" and estado_partido = 1 and id_partido != "'.$_POST['id_partido'].'" and FECHA_PARTIDO = "'.$fecha_partido.'" and
((("'.$hora_partido.'" >= hora_partido and "'.$hora_partido.'" < hora_fin) and ("'.$hora_fin.'" > hora_partido and "'.$hora_fin.'" >= hora_fin))
or (("'.$hora_partido.'" <= hora_partido and "'.$hora_partido.'" > hora_fin) and ("'.$hora_fin.'" > hora_partido and "'.$hora_fin.'" <= hora_fin))
or (hora_partido > "'.$hora_partido.'" AND hora_partido < "'.$hora_fin.'" ))';
if($miconexion->consulta($sql)){
$compr=$miconexion->consulta_lista();
if ($compr[0]=="0") {
$dias= array("0"=>'Domingo',"1"=>'Lunes',"2"=>'Martes',"3"=>'Miercoles',"4"=>'Jueves',"5"=>'Viernes',"6"=>'Sabado');
$i = strtotime($_POST['fecha_partido']);
$dia_fecha = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m",$i),date("d",$i), date("Y",$i)) , 0 );
$miconexion->consulta('select count(*) from horarios_centros where id_centro="'.$centro.'" and dia="'.$dias[$dia_fecha].'" and
("'.$hora_partido.'" >= hora_inicio AND "'.$hora_partido.'" < hora_fin)
AND
("'.$hora_fin.'" >= hora_inicio AND "'.$hora_fin.'" < hora_fin)');
$compr=$miconexion->consulta_lista();
if ($compr[0]!="0") {
$columnas[count($columnas)] = "hora_fin";
$lista[count($lista)] = $hora_fin;
$sql=$miconexion->sql_actualizar($bd,$lista,$columnas);
if($miconexion->consulta($sql)){
$sql = "insert into notificaciones (id_user, id_partido, fecha_not, visto, responsable, tipo, mensaje)
values ('".$tiempo_alquiler[1]."','".$_POST['id_partido']."','".date('Y-m-d H:i:s', time())."','0','".$_SESSION['id']."','cambios',' ha solicitado reservar el ".$_POST['fecha_partido']." a las ".date('g:i a', strtotime($_POST['hora_partido']))." para el partido')";
$miconexion->consulta($sql);
echo '<script>
$.get("../datos/cargarNotificaciones.php");