当前位置: 首页>>代码示例>>PHP>>正文


PHP JevDate::toUnix方法代码示例

本文整理汇总了PHP中JevDate::toUnix方法的典型用法代码示例。如果您正苦于以下问题:PHP JevDate::toUnix方法的具体用法?PHP JevDate::toUnix怎么用?PHP JevDate::toUnix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JevDate的用法示例。


在下文中一共展示了JevDate::toUnix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unixTime


//.........这里部分代码省略.........
                 $serveroffset = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S', $t)) - JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ', $t))) / 3600;
                 $serveroffset += $dst;
                 $t = new JevDate($ical_date, -($serveroffset + $offset));
             }
             /*
             echo "<h3>SET TIMEZONE</h3>";
             $timezone= date_default_timezone_get();
             date_default_timezone_set('America/New_York');
             
             $tempIcal  = "20091020T163000Z";
             echo $tempIcal."<br/>";
             $temp = JevDate::strtotime($tempIcal);
             list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
             echo "$y,$m,$d,$h,$min,$s<br/>";
             $dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
             $so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
             echo " dst=".$dst." serverforoffset=".$so."<br/>";
             $so += $dst;
             $t = new JevDate($tempIcal);
             echo $t->toMySQL()."<br><br/>";
             
             
             $tempIcal  = "20091029T163000Z";
             echo $tempIcal."<br/>";
             $temp = JevDate::strtotime($tempIcal);
             list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
             echo "$y,$m,$d,$h,$min,$s<br/>";
             $dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
             $so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
             echo " dst=".$dst." serverforoffset=".$so."<br/>";
             $so += $dst;
             $t = new JevDate($tempIcal );
             echo $t->toMySQL()."<br><br/>";
             
             $tempIcal  = "20091103T163000Z";
             echo $tempIcal."<br/>";
             $temp = JevDate::strtotime($tempIcal);
             list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
             echo "$y,$m,$d,$h,$min,$s<br/>";
             $dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
             $so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
             echo " dst=".$dst." serverforoffset=".$so."<br/>";
             $so += $dst;
             $t = new JevDate($tempIcal);
             echo $t->toMySQL()."<br>";
             */
         } else {
             if ($tz != false && $tz != "") {
                 // really should use the timezone of the inputted date
                 $tz = new DateTimeZone($tz);
                 $t = new JevDate($ical_date, $tz);
                 echo "icaldate = " . $ical_date . " imported date=" . $t->toMySQL() . "<br/>";
             } else {
                 $compparams = JComponentHelper::getParams(JEV_COM_COMPONENT);
                 $jtz = $compparams->get("icaltimezonelive", "");
                 if ($jtz) {
                     $t = new JevDate($ical_date, $jtz);
                 } else {
                     $t = new JevDate($ical_date);
                 }
             }
         }
         //$result = $t->toMySQL();
         $result = $t->toUnix();
         return $result;
     }
     $isUTC = false;
     if (JString::strpos($ical_date, "Z") !== false) {
         $isUTC = true;
     }
     // strip "T" and "Z" from the string
     $ical_date = str_replace('T', '', $ical_date);
     $ical_date = str_replace('Z', '', $ical_date);
     // split it out intyo YYYY MM DD HH MM SS
     preg_match("#([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})([0-9]{0,2})#", $ical_date, $date);
     list($temp, $y, $m, $d, $h, $min, $s) = $date;
     if (!$min) {
         $min = 0;
     }
     if (!$h) {
         $h = 0;
     }
     if (!$d) {
         $d = 0;
     }
     if (!$s) {
         $s = 0;
     }
     // Trap unix dated beofre 1970
     $y = max($y, 1970);
     if ($isUTC) {
         $t = gmJevDate::mktime($h, $min, $s, $m, $d, $y) + 3600 * $offset;
         $result = JevDate::strtotime(gmdate('Y-m-d H:i:s', $t));
     } else {
         $result = JevDate::mktime($h, $min, $s, $m, $d, $y);
     }
     // double check!!
     //list($y1,$m1,$d1,$h1,$min1,$s1)=explode(":",JevDate::strftime('%Y:%m:%d:%H:%M:%S',$result));
     return $result;
 }
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:101,代码来源:iCalImport.php

示例2: maprpts

 function maprpts()
 {
     $db =& JFactory::getDBO();
     $db->setQuery("delete from jos_repbyday");
     $db->query();
     $db->setQuery("SELECT rpt.rp_id, rpt.startrepeat, rpt.endrepeat, evt.catid FROM #__jevents_repetition as rpt LEFT JOIN #__jevents_vevent as evt ON rpt.eventid=evt.ev_id");
     $rpts = $db->loadObjectList();
     jimport("joomla.utilities.date");
     foreach ($rpts as $rpt) {
         $startday = new JevDate(substr($rpt->startrepeat, 0, 10));
         $endday = new JevDate(substr($rpt->endrepeat, 0, 10));
         while ($endday->toUnix() >= $startday->toUnix()) {
             $db->setQuery("replace into jos_jevents_repbyday (rptday,rp_id,catid) values('" . $startday->toFormat('%Y-%m-%d') . "'," . $rpt->rp_id . "," . $rpt->catid . ")");
             $db->query();
             $startday = new JevDate($startday->toUnix() + 86400);
         }
     }
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:18,代码来源:config.php

示例3: htmlspecialchars

        $item_organizer = html_entity_decode( $item_organizer );
        // location for particular item
        $item_location = htmlspecialchars( $row->location() );
        $item_location = html_entity_decode( $item_location );
        // start date for particular item
        $item_startdate = htmlspecialchars( $row->publish_up());
        // end date for particular item
        $item_enddate = htmlspecialchars( $row->publish_down() );
        if (isset($row->_thumbimg1) && $row->_thumbimg1!=""){
        	$item_description = $row->_thumbimg1. "<br/>".$item_description;
        }
        */
        // load individual item creator class
        $item = new JFeedItem();
        // item info
        if ($row->alldayevent()) {
            $temptime = new JevDate($eventDate);
            $item->title = $temptime->toFormat(JText::_('JEV_RSS_DATE')) . " : " . $item_title;
        } else {
            $temptime = new JevDate($eventDate);
            $item->title = $temptime->toFormat(JText::_('JEV_RSS_DATETIME')) . " : " . $item_title;
        }
        $item->link = $item_link;
        $item->description = $item_description;
        $item->category = $item_type;
        $eventcreated = new JevDate($row->created());
        $item->date = $eventcreated->toUnix(true);
        // add item info to RSS document
        $doc->addItem($item);
    }
}
开发者ID:poorgeek,项目名称:JEvents,代码行数:31,代码来源:rss.php

示例4: htmlspecialchars

        $item_organizer = html_entity_decode( $item_organizer );
        // location for particular item
        $item_location = htmlspecialchars( $row->location() );
        $item_location = html_entity_decode( $item_location );
        // start date for particular item
        $item_startdate = htmlspecialchars( $row->publish_up());
        // end date for particular item
        $item_enddate = htmlspecialchars( $row->publish_down() );
        if (isset($row->_thumbimg1) && $row->_thumbimg1!=""){
        	$item_description = $row->_thumbimg1. "<br/>".$item_description;
        }
        */
        // load individual item creator class
        $item = new JFeedItem();
        // item info
        if ($row->alldayevent()) {
            $temptime = new JevDate($eventDate);
            $item->set('title', $temptime->toFormat(JText::_('JEV_RSS_DATE')) . " : " . $item_title);
        } else {
            $temptime = new JevDate($eventDate);
            $item->set('title', $temptime->toFormat(JText::_('JEV_RSS_DATETIME')) . " : " . $item_title);
        }
        $item->set('link', $item_link);
        $item->set('description', $item_description);
        $item->set('category', $item_type);
        $eventcreated = new JevDate($row->created());
        $item->set('date', $eventcreated->toUnix(true));
        // add item info to RSS document
        $doc->addItem($item);
    }
}
开发者ID:madseller,项目名称:coperio,代码行数:31,代码来源:rss.php


注:本文中的JevDate::toUnix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。