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


PHP sql_datetime函数代码示例

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


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

示例1: write

 public function write($id, $data)
 {
     $time = time() + $this->expire_time;
     $q = 'REPLACE tblSessionData (session_id,session_data,expires) VALUES(?, ?, ?)';
     Sql::pUpdate($q, 'sss', $id, $data, sql_datetime($time));
     return true;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:7,代码来源:SessionStorageHandler.php

示例2: setStatus

 public static function setStatus($user_id, $text)
 {
     $status = new PersonalStatus();
     $status->owner = $user_id;
     $status->text = $text;
     $status->time_saved = sql_datetime(time());
     return $status->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:8,代码来源:PersonalStatus.php

示例3: create

 /**
  * Creates a new visit entry
  * @param $type
  * @param $owner_id
  * @param $ref_id
  */
 public static function create($type, $owner_id, $ref_id)
 {
     $o = new Visit();
     $o->type = $type;
     $o->owner = $owner_id;
     $o->ref = $ref_id;
     $o->time = sql_datetime(time());
     $o->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:15,代码来源:Visit.php

示例4: markHandled

 /**
  * Mark feedback item as handled
  * @param $message_id optionally refer to a response message
  */
 public static function markHandled($id, $message_id = 0)
 {
     $session = SessionHandler::getInstance();
     $i = self::get($id);
     $i->time_answered = sql_datetime(time());
     $i->answered_by = $session->id;
     $i->message = $message_id;
     $i->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:13,代码来源:Feedback.php

示例5: set

 public static function set($owner, $type, $user_id)
 {
     $l = new Like();
     $l->owner = $owner;
     $l->type = $type;
     $l->user = $user_id;
     $l->time = sql_datetime(time());
     $l->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:9,代码来源:Like.php

示例6: send

 /**
  * Creates a new poke
  * @param $to
  */
 public static function send($to)
 {
     $session = SessionHandler::getInstance();
     $o = new Poke();
     $o->from = $session->id;
     $o->to = $to;
     $o->time = sql_datetime(time());
     $o->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:13,代码来源:Poke.php

示例7: editHandler

 function editHandler($p)
 {
     $session = SessionHandler::getInstance();
     $o = FaqItem::get($p['id']);
     $o->question = $p['q'];
     $o->answer = $p['a'];
     $o->creator = $session->id;
     $o->time_created = sql_datetime(time());
     $o->store();
     js_redirect('a/faq');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:11,代码来源:faq.php

示例8: send

 /**
  * @return message id
  */
 public static function send($to, $msg, $type = PRIV_MSG)
 {
     $session = SessionHandler::getInstance();
     $m = new Message();
     $m->to = $to;
     $m->from = $session->id;
     $m->body = $msg;
     $m->type = $type;
     $m->time_sent = sql_datetime(time());
     return $m->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:14,代码来源:Message.php

示例9: add

 public static function add($type, $reference = 0, $data = '')
 {
     $session = SessionHandler::getInstance();
     $c = new ModerationObject();
     $c->type = $type;
     $c->owner = $session->id;
     $c->time_created = sql_datetime(time());
     $c->data = $data;
     $c->reference = $reference;
     $c->id = $c->store();
     return $c->id;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:12,代码来源:ModerationObject.php

示例10: ago

/**
 * Converts a SQL timestamp to a text string representing how long ago this timestamp occured
 *
 * @param $sql_time SQL timestamp
 * @return text string representing how long ago this timestamp occured
 */
function ago($sql_time, $past = 'ago', $future = 'in', $just_now = 'just now')
{
    $old_time = ts(sql_datetime($sql_time));
    $curr_time = time();
    if ($curr_time == $old_time) {
        return $just_now;
    }
    if ($curr_time >= $old_time) {
        return elapsed_seconds($curr_time - $old_time, 0) . ' ' . $past;
    }
    return $future . ' ' . elapsed_seconds($old_time - $curr_time, 0);
}
开发者ID:martinlindhe,项目名称:core_dev,代码行数:18,代码来源:time.php

示例11: update

 public function update()
 {
     $db = Database::get_instance();
     $time_updated = sql_datetime();
     $query = $db->prepare("UPDATE aspect_groups SET group_name=?, update_date=? WHERE id=?");
     $data = array($this->group_name, $time_updated, $this->id);
     if ($query->execute($data)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:imonroe,项目名称:coldreader,代码行数:12,代码来源:AspectGroup_class.php

示例12: createHandler

 function createHandler($p)
 {
     $session = SessionHandler::getInstance();
     $o = new BlogEntry();
     $o->owner = $session->id;
     $o->subject = trim($p['subject']);
     $o->body = trim($p['body']);
     $o->time_created = sql_datetime(time());
     $o->time_published = sql_datetime(time());
     $o->id = $o->store();
     js_redirect('a/blogs/overview');
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:12,代码来源:blogs.php

示例13: save

 public function save()
 {
     $db = Database::get_instance();
     $time_saved = sql_datetime();
     $query = $db->prepare("INSERT INTO log (message, time) VALUES (?, ?)");
     $data = array($this->message, $time_saved);
     if ($query->execute($data)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:imonroe,项目名称:coldreader,代码行数:12,代码来源:LogEntry_class.php

示例14: update

 public function update()
 {
     $db = Database::get_instance();
     $time_updated = sql_datetime();
     $query = $db->prepare("UPDATE subject_types SET type_name=?, type_description=?, aspect_group=?, update_date=?, parent_id=? WHERE id=?");
     $data = array($this->type_name, $this->type_description, $this->aspect_group, $time_updated, $this->parent_id, $this->id);
     if ($query->execute($data)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:imonroe,项目名称:coldreader,代码行数:12,代码来源:SubjectType_class.php

示例15: create

 /**
  * Helper function to create new comments
  */
 public static function create($type, $owner, $msg, $private = false)
 {
     $session = SessionHandler::getInstance();
     $c = new Comment();
     $c->type = $type;
     $c->owner = $owner;
     $c->msg = $msg;
     $c->private = $private;
     $c->creator = $session->id;
     $c->creator_ip = client_ip();
     $c->time_created = sql_datetime(time());
     return $c->store();
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:16,代码来源:Comment.php


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