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


PHP datetime_now函数代码示例

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


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

示例1: on_before_validate

 function on_before_validate($values)
 {
     if ($values['username'] == "" || $values['username'] == NULL) {
         $this->password_in_clear = $password = $this->random_password();
         $ci = CI_Controller::get_instance();
         $ci->load->helper('url');
         $ci->load->library('session');
         $ci->load->library('extemplate');
         $ci->load->library("email");
         $ci->load->config('tank_auth', TRUE);
         $hasher = new PasswordHash($ci->config->item('phpass_hash_strength', 'tank_auth'), $ci->config->item('phpass_hash_portable', 'tank_auth'));
         $hashed_password = $hasher->HashPassword($password);
         $values["password"] = $hashed_password;
         $values["created"] = datetime_now();
         $values['username'] = trim($values['email']);
         $values["last_ip"] = $_SERVER['REMOTE_ADDR'];
         $data = $values;
         $data['site_name'] = 'http://www.ressphere.com';
         $data['password'] = $this->password_in_clear;
         if ($ci->config->item('email_account_details')) {
             base::_begin_send_email('Welcome to', $data['email'], $data, $ci);
         }
     }
     return parent::on_before_validate($values);
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:25,代码来源:users_model.php

示例2: form_fields

 public function form_fields($values = array(), $related = array())
 {
     $fields = parent::form_fields($values, $related);
     $fields['publish_date']['comment'] = 'If blank, will default to current date/time';
     $fields['publish_date']['value'] = datetime_now();
     return $fields;
 }
开发者ID:nonconforme,项目名称:FUEL-CMS,代码行数:7,代码来源:careers_model.php

示例3: on_before_clean

 function on_before_clean($values = array())
 {
     if (!(int) $values['date_added']) {
         $values['date_added'] = datetime_now();
     }
     return $values;
 }
开发者ID:hawkeye64,项目名称:FUEL-CMS-Blog-Module,代码行数:7,代码来源:blog_users_model.php

示例4: form_fields

 function form_fields($values = array(), $related = array())
 {
     $fields = parent::form_fields($values, $related);
     $fields['post_date']['comment'] = 'If blank, will default to current date/time';
     $fields['post_date']['value'] = datetime_now();
     $fields['skillset_requirements']['class'] = 'no_editor';
     return $fields;
 }
开发者ID:ressphere,项目名称:cb_iloveproperty,代码行数:8,代码来源:careers_model.php

示例5: logit

 function logit($msg, $user = null)
 {
     $CI =& get_instance();
     if (empty($user)) {
         $user = $CI->fuel_auth->user_data();
     }
     $save['user_id'] = $user['id'];
     $save['message'] = $msg;
     $save['entry_date'] = datetime_now();
     $this->save($save);
 }
开发者ID:randombrad,项目名称:FUEL-CMS,代码行数:11,代码来源:logs_model.php

示例6: import_view_cancel

 function import_view_cancel()
 {
     if ($this->input->post('id')) {
         // don't need to pass anything because it will automatically update last_modified'
         $save['id'] = $this->input->post('id');
         $save['name'] = $this->input->post('name');
         $save['last_modified'] = datetime_now();
         if ($this->model->save($save)) {
             $this->output->set_output('success');
             return;
         }
     }
     $this->output->set_output('error');
 }
开发者ID:randombrad,项目名称:FUEL-CMS,代码行数:14,代码来源:blocks.php

示例7: logit

 /**
  * Saves to the logging table
  *
  * @access	public
  * @param	string The message to associate with the log
  * @param	string The type of log (optional)
  * @param	int The user ID associated with the log (optional)
  * @return	boolean TRUE if saved correctly. FALSE otherwise
  */
 public function logit($msg, $type = NULL, $user_id = NULL)
 {
     $CI =& get_instance();
     if (!isset($user_id)) {
         $user = $CI->fuel->auth->user_data();
         if (isset($user['id'])) {
             $user_id = $user['id'];
         }
     }
     $save['message'] = $msg;
     $save['type'] = $type;
     $save['user_id'] = $user_id;
     $save['entry_date'] = datetime_now();
     return $this->save($save);
 }
开发者ID:huayuxian,项目名称:FUEL-CMS,代码行数:24,代码来源:fuel_logs_model.php

示例8: datetime_now

<p>Extends the CodeIgniter date helper functions. This helper is <strong>autoloaded</strong>.</p>

<p>This helper is loaded using the following code:</p>

<pre class="brush: php">
$this->load->helper('date');
</pre>

<p>The following functions are available:</p>

<h2>datetime_now()</h2>
<p>Returns a the current time in a yyyy-mm-dd hh:mm:ss format which can be used with MySQL databases.</p>
<pre class="brush: php">
echo datetime_now();
// <?php 
echo datetime_now();
?>
</pre>


<h2>is_date_format('<var>date</var>')</h2>
<p>Returns a boolean value as to whether the date is in an english (mm/dd/yyyy) or database (yyyy-mm-dd) format.</p>
<pre class="brush: php">
is_date_format('2010/01/01');
// returns FALSE

is_date_format('2010-01-01');
// returns TRUE
</pre>

开发者ID:kieranklaassen,项目名称:FUEL-CMS,代码行数:29,代码来源:my_date_helper.php

示例9: find_upcoming

 public function find_upcoming($limit = NULL)
 {
     return $this->find_all(array('start_date >=' => datetime_now()), NULL, $limit);
 }
开发者ID:huayuxian,项目名称:FUEL-CMS,代码行数:4,代码来源:events_model.php

示例10: datetime_now

    ?>
" ;
		var UPLOADDO_URL = "<?php 
    echo ADMINER_URL . '/upload/';
    ?>
";
		<?php 
}
?>
		var UPLOAD_URL  = "<?php 
echo UPLOAD_URL;
?>
" ;
		var mime = ["video/*","image/*"];
		var	today = '<?php 
echo datetime_now(false);
?>
';
		// cookie theme
		</script>

		<!--[if lt IE 9]>
			<?php 
//echo static_file('IE9.js');
?>
			
		<![endif]-->

		<?php 
echo static_file('jquery-1.10.2.js');
echo static_file('normalize.css');
开发者ID:PoppyLi,项目名称:PCMS,代码行数:31,代码来源:inc_header.php

示例11: datetime_now

                }
            }
            // ..end for
            break;
        case "DB":
            $result = $site->fetch_live_data();
            if ($result === FALSE) {
                $data['notice']['error'] = "DB Error: fetching records failed";
            }
            break;
    }
}
//debug_show($result);
// check for errors
if (!empty($data['notice']['error'])) {
    $message = datetime_now() . " - " . $data['notice']['error'] . "\n";
    log_message($settings['log_file'], $message);
} else {
    if ($site->request_value == "all") {
        //debug_show($result);
        return $result;
    } else {
        $show_sport = $site->json_sports_config();
        $requested_sport = str_replace(' ', '', $site->request_value);
        //if (isset($show_sport[$site->request_value]['code']))
        if (isset($show_sport[$requested_sport]['code'])) {
            //debug_show($result[$show_sport[$site->request_value]['code']]);
        } else {
            echo " No result has found: " . $site->request_value;
        }
    }
开发者ID:cxth,项目名称:allsportlive-beta,代码行数:31,代码来源:cron.php

示例12: on_before_save

 public function on_before_save($values)
 {
     parent::on_before_save($values);
     if (empty($values[$this->order_by_field])) {
         $values[$this->order_by_field] = datetime_now();
     }
     return $values;
 }
开发者ID:huayuxian,项目名称:FUEL-CMS,代码行数:8,代码来源:base_posts_model.php

示例13: _publish_status

 /**
  * Used for displaying content that is published
  *
  * @access	protected
  * @return	void
  */
 protected function _publish_status()
 {
     $fields = $this->fields();
     if (in_array('published', $fields)) {
         if (in_array('published', $this->boolean_fields)) {
             $this->db->where(array($this->table_name . '.published' => 1));
         } else {
             $this->db->where(array($this->table_name . '.published' => 'yes'));
         }
     }
     if (in_array('active', $fields)) {
         if (in_array('active', $this->boolean_fields)) {
             $this->db->where(array($this->table_name . '.active' => 1));
         } else {
             $this->db->where(array($this->table_name . '.active' => 'yes'));
         }
     }
     if (in_array('publish_date', $fields)) {
         $this->db->where(array('publish_date <=' => datetime_now()));
     }
 }
开发者ID:pwhsueh,项目名称:voting,代码行数:27,代码来源:base_module_model.php

示例14: FALSE

<p>Extends the CodeIgniter date helper functions. This helper is <strong>autoloaded</strong>.</p>

<p>This helper is loaded using the following code:</p>

<pre class="brush: php">
$this->load->helper('date');
</pre>

<p>The following functions are available:</p>

<h2>datetime_now([<var>hms</var>])</h2>
<p>Returns a the current time in a yyyy-mm-dd hh:mm:ss format which can be used with MySQL databases. The optional parameter
will return the current date without the time if set to FALSE (default is TRUE).</p>
<pre class="brush: php">
echo datetime_now(); // <?=datetime_now()?> 
echo datetime_now(FALSE); // <?=datetime_now(FALSE)?>
</pre>


<h2>is_date_format('<var>date</var>')</h2>
<p>Returns a boolean value as to whether the date is in an english (mm/dd/yyyy) or database (yyyy-mm-dd) format.</p>
<pre class="brush: php">
is_date_format('2010/01/01');
// returns FALSE

is_date_format('2010-01-01');
// returns TRUE
</pre>


<h2>is_date_db_format('<var>date</var>')</h2>
开发者ID:rodrigowebe,项目名称:FUEL-CMS,代码行数:31,代码来源:my_date_helper.php

示例15: on_before_clean

 function on_before_clean($values)
 {
     $values['slug'] = empty($values['slug']) && !empty($values['title']) ? url_title($values['title'], 'dash', TRUE) : url_title($values['slug'], 'dash');
     if (empty($values['post_date'])) {
         $values['post_date'] = datetime_now();
     }
     // create author if it doesn't exists'
     $CI =& get_instance();
     $id = !empty($values['author_id']) ? $values['author_id'] : $CI->fuel->auth->user_data('id');
     $CI->load->module_model(BLOG_FOLDER, 'blog_users_model');
     $author = $CI->blog_users_model->find_one(array('fuel_user_id' => $id));
     if (!isset($author->id)) {
         $author = $CI->blog_users_model->create();
         $author->fuel_user_id = $CI->fuel->auth->user_data('id');
         // determine a display name if one isn't provided'
         if (trim($author->display_name) == '') {
             $display_name = $CI->fuel->auth->user_data('first_name') . ' ' . $this->fuel->auth->user_data('last_name');
             if (trim($display_name) == '') {
                 $display_name = $CI->fuel->auth->user_data('email');
             }
             if (empty($display_name)) {
                 $display_name = $CI->fuel->auth->user_data('user_name');
             }
             $author->display_name = $display_name;
         }
         // save author
         $author->save();
         $values['author_id'] = $author->fuel_user_id;
     }
     return $values;
 }
开发者ID:pwhsueh,项目名称:voting,代码行数:31,代码来源:blog_posts_model.php


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