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


PHP date类代码示例

本文整理汇总了PHP中date的典型用法代码示例。如果您正苦于以下问题:PHP date类的具体用法?PHP date怎么用?PHP date使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: draw

 function draw()
 {
     $object = $this->popMailbox();
     if (!$object) {
         $object = new date();
         $object->timestamp = time();
         $object->parse();
     }
     //if (!$object) $object = new date(); $object->timestamp = 0; $object->parse();
     $out .= "<select name=\"" . ($this->__prefix ? $this->__prefix . "_" : "") . $this->selector_day . "\">";
     $out .= "<option value=\"0\" " . ($object->string == "N/A" ? "selected" : "") . ">--</option>";
     for ($i = 1; $i < 32; $i++) {
         $out .= "\n\t<option value=\"" . $i . "\" " . ($object->day == $i ? "selected" : "") . ">" . $i . "</option>";
     }
     $out .= "</select>";
     $out .= "<select name=\"" . ($this->__prefix ? $this->__prefix . "_" : "") . $this->selector_month . "\">";
     $out .= "<option value=\"0\" " . ($object->string == "N/A" ? "selected" : "") . ">--</option>";
     for ($i = 1; $i < 13; $i++) {
         $out .= "\n\t<option value=\"" . $i . "\" " . ($object->month == $i ? "selected" : "") . ">" . $object->__months[$i] . "</option>";
     }
     $out .= "</select>";
     $out .= "<select name=\"" . ($this->__prefix ? $this->__prefix . "_" : "") . $this->selector_year . "\">";
     $out .= "<option value=\"0\" " . ($object->string == "N/A" ? "selected" : "") . ">--</option>";
     for ($i = 1970; $i < 2020; $i++) {
         $out .= "\n\t<option value=\"" . $i . "\" " . ($object->year == $i ? "selected" : "") . ">" . $i . "</option>";
     }
     $out .= "</select>";
     //$out .="<input type=\"text\" name=\"".($this->__prefix ? $this->__prefix."_" : "").$this->selector_hour."\" value=\"".$object->hour."\" size=\"2\"> : <input type=\"text\" name=\"".($this->__prefix ? $this->__prefix."_" : "").$this->selector_minutes."\" value=\"".$object->minutes."\" size=\"2\">";
     return $out;
 }
开发者ID:Esleelkartea,项目名称:arotz,代码行数:30,代码来源:dateselector.class.php

示例2: datestring

 function datestring($timestamp)
 {
     $d = new date();
     $d->timestamp = $timestamp;
     $d->parse();
     $this->timestamp = $timestamp;
     $this->string = $d->string;
 }
开发者ID:Esleelkartea,项目名称:arotz,代码行数:8,代码来源:datestring.class.php

示例3: test_new_host_new_day

 function test_new_host_new_day()
 {
     $this->test_new_host();
     $date = new date();
     $date->set_by_days($date->date_to_days() + 1);
     $this->stats_counter->set_new_host();
     $this->stats_counter->update($date);
     $this->_check_stats_counter_record($hits_all = 2, $hits_today = 1, $hosts_all = 2, $hosts_today = 1, $date);
     $this->_check_stats_day_counters_record($hits_today, $hosts_today, $home_hits = 0, $audience_host = 0, $date);
     $this->_check_counters_consistency($date);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:11,代码来源:stats_counter_test.class.php

示例4: test_same_host_wrong_day

 function test_same_host_wrong_day()
 {
     $date1 = new date();
     $ip = ip::encode_ip('192.168.0.5');
     $this->stats_ip->setReturnValue('get_client_ip', $ip);
     $this->stats_ip->is_new_host($date1);
     $date2 = new date();
     $date2->set_by_days($date1->date_to_days() - 2);
     $this->stats_ip->setReturnValueAt(1, 'get_client_ip', $ip);
     $this->assertFalse($this->stats_ip->is_new_host($date2));
     $this->_check_stats_ip_record($total_records = 1, $ip, $date1);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:12,代码来源:stats_ip_test.class.php

示例5: new_token

 /**
  * Permet de créer un TOKEN sous la base Encrypteur NOCTUS, il est vérifier et déchiffrer par le décrypteur NOCTUS
  * @return string
  */
 public function new_token()
 {
     $date_format = new date();
     $date = $date_format->format_strt("d-m-Y H:i:s");
     $username = $this->username;
     $password = $this->password;
     $chaine = "azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN&0123456789_@";
     $shuff = str_shuffle($chaine);
     $key = substr($shuff, 0, 15);
     $token = $username . "_" . $key . "_" . $password . "_" . time();
     return $token;
 }
开发者ID:CRIDIP-SWD,项目名称:GAMESHOP,代码行数:16,代码来源:encrypt.php

示例6: __visitor_count_month

 public function __visitor_count_month($date)
 {
     $start_date;
     $start = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-01 00:00"));
     $final_date = $this->_plus_month($date);
     $end = date('Y-m-d H:i', strtotime($final_date['year'] . "-" . $final_date['month'] . "-01 00:00"));
     $html = "";
     $html .= "<p>total visits: " . stats::get_visitor_count($start, $end) . "</p>";
     $html .= "<p>unique visitors: " . stats::get_visitor_count($start, $end, true) . "</p>";
     $views = array();
     $unique = array();
     foreach (date::days($date['month'], $date['year']) as $day) {
         $start = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-" . $day . " 00:00"));
         $end_day = $day + 1;
         if (count(date::days($date['month'], $date['year'])) < $end_day) {
             $end = date('Y-m-d H:i', strtotime($final_date['year'] . "-" . $final_date['month'] . "-01 00:00"));
         } else {
             $end = date('Y-m-d H:i', strtotime($date['year'] . "-" . $date['month'] . "-" . ($day + 1) . " 00:00"));
         }
         $count = stats::get_visitor_count($start, $end);
         $views[$day] = $count;
         $count = stats::get_visitor_count($start, $end, true);
         $unique[$day] = $count;
     }
     $chart = new GoogChart();
     $dataMultiple = array("Page views" => $views, "Unique visitors" => $unique);
     $min = 0;
     $max = 10;
     //	chxr='y',$min,$max,(($max-$min)/10);
     /* # Chart 2 # */
     $chart->setChartAttrs(array('type' => 'line', 'title' => 'Visits for ' . date('F Y', strtotime($start)), 'data' => $dataMultiple, 'size' => array(750, 200), 'labelsXY' => true, 'color' => array('#27aae1', '#e127aa')));
     // Print chart
     $html .= $chart;
     return $html;
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:35,代码来源:stats.php

示例7: __construct

 public function __construct($year, $weekno)
 {
     $this->week = $weekno;
     $this->year = $year;
     $day = date::new_from_format("{$year}-W{$weekno}");
     $this->push($day);
     while ($day->get_day_of_week() != 7) {
         $day = $day->tomorrow();
         $this->push($day);
     }
     // The day can be any day in a week. So we start to push
     // the asked day, then we push comming days, then we revert the day's storage, then we push
     // the passed days until the first, and revert the storage.
     /*
     $aday = $day;
     $this->push($aday);
     
     while($aday->get_day_of_week() != 7)
     {
     	$aday = $aday->tomorrow();
     	$this->push($aday);
     }
     
     $this->reverse();
     $aday = $day;
     
     while($aday->get_day_of_week() != 1)
     {
     	$aday = $aday->yesterday();
     	$this->push($aday);
     }
     
     $this->reverse();
     */
 }
开发者ID:LupusMichaelis,项目名称:horn,代码行数:35,代码来源:duration.php

示例8: _set_period_filter

 function _set_period_filter()
 {
     $locale =& locale::instance();
     $start_date = new date();
     $start_date->set_hour(0);
     $start_date->set_minute(0);
     $start_date->set_second(0);
     if (isset($_REQUEST['stats_start_date'])) {
         $start_date->set_by_string($_REQUEST['stats_start_date'], $locale->get_short_date_time_format());
     }
     $finish_date = new date();
     if (isset($_REQUEST['stats_finish_date'])) {
         $finish_date->set_by_string($_REQUEST['stats_finish_date'], $locale->get_short_date_time_format());
     }
     $this->stats_report->set_period_filter($start_date, $finish_date);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:16,代码来源:stats_hits_hosts_list_datasource.class.php

示例9: __get

 /**
  * Output dates as friendly dates
  * @developer Brandon Hansen
  * @date May 16, 2010
  */
 public function __get($key)
 {
     if (in_array($key, array('created_at', 'modified_at'))) {
         return date::full_date_time(parent::__get($key));
     } else {
         return parent::__get($key);
     }
 }
开发者ID:ready4god2513,项目名称:Journal,代码行数:13,代码来源:MY_ORM.php

示例10: week_days

 public function week_days($year = FALSE, $week = FALSE)
 {
     $w = date::week($year, $week);
     $list = array();
     for ($day = 0; $day <= 6; $day++) {
         $list[] = date('Y-m-d', strtotime($w['year'] . "W" . $w['week'] . $day));
     }
     return $list;
 }
开发者ID:hiltongoncalves,项目名称:SAPO,代码行数:9,代码来源:MY_date.php

示例11: edit

 /**
  * Make sure that the one to update belongs to the user
  * @Developer brandon
  * @Date May 19, 2010
  */
 public function edit($id = NULL)
 {
     $journal = ORM::factory('journal', $id);
     if ($journal->user->id != user::current()->id) {
         url::redirect('');
     }
     meta::set_title(date::user_friendly_date($journal->created_at) . ' : ' . $journal->title);
     parent::edit($id);
 }
开发者ID:ready4god2513,项目名称:Journal,代码行数:14,代码来源:journals.php

示例12: lista_semana

 public function lista_semana()
 {
     $semana = date::week_days();
     //echo Kohana::debug($semana);
     $lista = array();
     foreach ($semana as $dia) {
         $lista[$dia] = ORM::Factory('procedimento')->where('data', $dia)->find_all();
     }
     return $lista;
 }
开发者ID:hiltongoncalves,项目名称:SAPO,代码行数:10,代码来源:procedimento.php

示例13: load_value

 protected function load_value()
 {
     if (is_bool($this->valid)) {
         return;
     }
     $time = $this->input_value($this->name);
     // Make sure all the required inputs keys are set
     $time += $this->time_array(time());
     $this->data['value'] = mktime(date::adjust($time['hour'], $time['am_pm']), $time['minute'], 0, $time['month'], $time['day'], $time['year']);
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:10,代码来源:Form_Dateselect.php

示例14: setEstimatedEndDate

 /**
  * Set estimated_end_date
  *
  * @param date $estimated_end_date
  */
 public function setEstimatedEndDate($estimated_end_date)
 {
     if ($this->getId() && $this->estimated_end_date != $estimated_end_date) {
         $current = isset($this->estimated_end_date) ? $this->estimated_end_date->format('Y-m-d') : '';
         $this->getLastNote()->addChange("Estimated end date changed from '{$current}' to '{$estimated_end_date->format('Y-m-d')}'");
     }
     if ($this->getOriginalEstimatedEndDate() == null) {
         $this->setOriginalEstimatedEndDate($estimated_end_date);
     }
     $this->estimated_end_date = $estimated_end_date;
 }
开发者ID:jackbravo,项目名称:symfony-sandbox,代码行数:16,代码来源:Project.php

示例15: _get_mail_body

 function _get_mail_body($template_path)
 {
     $template = new template($template_path);
     $locale =& locale::instance();
     $date = new date();
     $template->set('date', $date->format($locale->get_short_date_format()));
     $cart =& cart::instance();
     $list =& $template->find_child('cart_items');
     $list->register_dataset($cart->get_items_array_dataset());
     $template->set('name', $this->dataspace->get('name'));
     $template->set('notes', $this->dataspace->get('notes'));
     $template->set('phone', $this->dataspace->get('phone'));
     $template->set('address', $this->dataspace->get('address'));
     $template->set('email', $this->dataspace->get('email'));
     ob_start();
     $template->display();
     $content = ob_get_contents();
     ob_end_clean();
     return $content;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:20,代码来源:checkout_cart_order_action.class.php


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