本文整理汇总了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);
}
示例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;
}
示例3: on_before_clean
function on_before_clean($values = array())
{
if (!(int) $values['date_added']) {
$values['date_added'] = datetime_now();
}
return $values;
}
示例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;
}
示例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);
}
示例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');
}
示例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);
}
示例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>
示例9: find_upcoming
public function find_upcoming($limit = NULL)
{
return $this->find_all(array('start_date >=' => datetime_now()), NULL, $limit);
}
示例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');
示例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;
}
}
示例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;
}
示例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()));
}
}
示例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>
示例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;
}