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


PHP Date::now方法代码示例

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


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

示例1: onCreate

 public function onCreate($credit, $input)
 {
     if ((int) $credit->user_id !== 0 or !empty($credit->email)) {
         // Compile the basic data
         $data = ['type' => $credit->type, 'value' => $credit->present()->valueLong];
         // Compile the user account info
         if ((int) $credit->user_id !== 0) {
             // Set the email info
             $email = $credit->user->email;
             $data['subject'] = $subject = "Credit Has Been Added to Your Account";
             $data['email'] = "user";
             // Start the expiration timer
             if ($credit->type == 'time') {
                 $credit->update(['expires' => \Date::now()->addDay()->addYear()->startOfDay()]);
             }
         }
         // Compile the email address info
         if (!empty($credit->email)) {
             $email = $credit->email;
             $data['subject'] = $subject = "You've Been Given Credit with Brian Jacobs Golf";
             $data['email'] = "email";
         }
         // Send the email
         Mail::send('emails.creditAdded', $data, function ($msg) use($email, $subject) {
             $msg->to($email)->subject(Config::get('bjga.email.subject') . " {$subject}")->replyTo(Config::get('bjga.email.contact'));
         });
     }
 }
开发者ID:kleitz,项目名称:bjga-scheduler,代码行数:28,代码来源:CreditEventHandler.php

示例2: generateDefaultsFor

 /**
  * Generate the complete comment entry default structure.
  *
  * @param  int $comment_ID The comment id.
  * @param  int $comment_post_ID The if of the post the comment refers to.
  *
  * @return array                An associative array of column/default values.
  */
 protected static function generateDefaultsFor($comment_ID, $comment_post_ID)
 {
     $randIP = "" . mt_rand(0, 255) . "." . mt_rand(0, 255) . "." . mt_rand(0, 255) . "." . mt_rand(0, 255);
     $content = self::generateCommentContent();
     $defaults = array('comment_ID' => $comment_ID, 'comment_post_ID' => $comment_post_ID, 'comment_author' => 'John Doe', 'comment_author_email' => 'john.doe@example.com', 'comment_author_url' => 'http://www.johndoe.com', 'comment_author_IP' => $randIP, 'comment_date' => Date::now(), 'comment_date_gmt' => Date::gmtNow(), 'comment_content' => $content, 'comment_karma' => 0, 'comment_approved' => 1, 'comment_agent' => '', 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 0);
     return $defaults;
 }
开发者ID:Bostonncity,项目名称:wp-browser,代码行数:15,代码来源:Comment.php

示例3: interval

 /**
  * @return string
  * @param string|Date $from
  * @param string|Date $to
  * @param string $glue
  * @param string $separator
  */
 public static function interval($from, $to, $glue = ' ', $separator = ' ')
 {
     $fromDate = self::create($from)->midnight();
     $toDate = self::create($to)->midnight();
     if ($fromDate->getTimestamp() === $toDate->getTimestamp()) {
         return $fromDate->format('j') . $glue . $fromDate->month() . $glue . $fromDate->format('Y') . $glue . self::YEAR_STRING;
     }
     $nowYear = Date::now()->format('Y');
     $isOneYear = $fromDate->format('Y') === $toDate->format('Y');
     $isOneMonth = $isOneYear && $fromDate->format('m') === $toDate->format('m');
     $toString = '';
     $fromString = '';
     $toString .= $toDate->format('Y') . $glue . self::YEAR_STRING;
     if (!$isOneYear) {
         $fromString .= $fromDate->format('Y') . $glue . self::YEAR_STRING;
     }
     $toString = $toDate->month() . (empty($toString) ? '' : $glue . $toString);
     if (!$isOneMonth) {
         $fromString = $fromDate->month() . (empty($fromString) ? '' : $glue . $fromString);
     }
     $toString = $toDate->format('j') . (empty($toString) ? '' : $glue . $toString);
     $fromString = $fromDate->format('j') . (empty($fromString) ? '' : $glue . $fromString);
     $result = self::FROM_STRING . $glue . $fromString . $separator . self::TO_STRING . $glue . $toString;
     $result = str_replace($glue . $glue, $glue, $result);
     return $result;
 }
开发者ID:visor,项目名称:nano,代码行数:33,代码来源:Date.php

示例4: save

 public function save()
 {
     if (!$this->created_on) {
         $this->created_on = Date::now();
     }
     return parent::save();
 }
开发者ID:houtsnip,项目名称:bruno_test,代码行数:7,代码来源:Answer.php

示例5: dstEnd

 /**
  * Calculates end of DST (daylight savings time)
  * This is the last Sunday of October
  *
  * @param   int year default -1 Year, defaults to current year
  * @return  util.Date
  */
 public static function dstEnd($year = -1)
 {
     $date = $year == -1 ? Date::now() : Date::create($year, 1, 1, 0, 0, 0);
     $transition = TimeZoneTransition::nextTransition(new TimeZone('Europe/Berlin'), $date);
     while ($transition->isDst()) {
         $transition->next();
     }
     return $transition->getDate();
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:16,代码来源:Calendar.class.php

示例6: get

 public static function get($key, $group = 'default')
 {
     $full_file = self::$dir . '/' . serialize($group . $key);
     if ($file = File::load($full_file)) {
         if (Date::dateDiff(Date::now(), $file->getModifiedDate(), 's') > self::$cacheTime) {
             File::remove($full_file);
             return false;
         }
         return unserialize($file->content());
     }
     return false;
 }
开发者ID:wijnandmet,项目名称:Foundation,代码行数:12,代码来源:cache.php

示例7: log

 public function log($context, $appMessages)
 {
     $logFile = _hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->path);
     $req = $context->request;
     $res = $context->response;
     $userDetails = $req->get_clientIP();
     if ((null !== $context->session ? $context->session->get_id() : null) !== null) {
         $userDetails .= " " . _hx_string_or_null(null !== $context->session ? $context->session->get_id() : null);
     }
     if (($context->auth !== null && $context->auth->get_currentUser() !== null ? $context->auth->get_currentUser()->get_userID() : null) !== null) {
         $userDetails .= " " . _hx_string_or_null($context->auth !== null && $context->auth->get_currentUser() !== null ? $context->auth->get_currentUser()->get_userID() : null);
     }
     $content = "" . Std::string(Date::now()) . " [" . _hx_string_or_null($req->get_httpMethod()) . "] [" . _hx_string_or_null($req->get_uri()) . "] from [" . _hx_string_or_null($userDetails) . "], response: [" . _hx_string_rec($res->status, "") . " " . _hx_string_or_null($res->get_contentType()) . "]\n";
     $_g = 0;
     $_g1 = $context->messages;
     while ($_g < $_g1->length) {
         $msg = $_g1[$_g];
         ++$_g;
         $content .= "\t" . _hx_string_or_null(ufront_log_FileLogger::format($msg)) . "\n";
         unset($msg);
     }
     if ($appMessages !== null) {
         $_g2 = 0;
         while ($_g2 < $appMessages->length) {
             $msg1 = $appMessages[$_g2];
             ++$_g2;
             $content .= "\t" . _hx_string_or_null(ufront_log_FileLogger::format($msg1)) . "\n";
             unset($msg1);
         }
     }
     $path = haxe_io_Path::directory($logFile);
     $path1 = haxe_io_Path::addTrailingSlash($path);
     $_p = null;
     $parts = new _hx_array(array());
     while ($path1 !== ($_p = haxe_io_Path::directory($path1))) {
         $parts->unshift($path1);
         $path1 = $_p;
     }
     $_g3 = 0;
     while ($_g3 < $parts->length) {
         $part = $parts[$_g3];
         ++$_g3;
         if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) {
             @mkdir($part, 493);
         }
         unset($part);
     }
     $file = sys_io_File::append(_hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->path), null);
     $file->writeString($content);
     $file->close();
     return ufront_core_SurpriseTools::success();
 }
开发者ID:kevinresol,项目名称:mvc-platform-test,代码行数:52,代码来源:FileLogger.class.php

示例8: check_login

 function check_login(&$system)
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (isset($_GET['logout'])) {
         if ($_GET['logout'] == '') {
             $_GET['logout'] = $_SESSION['RheinaufCMS_User']['Anrede'] . ' ' . $_SESSION['RheinaufCMS_User']['Name'];
         }
         unset($_SESSION['RheinaufCMS_User']);
         setcookie('RheinaufCMS_user', false, time() - 3600, '/');
     }
     if ($_SESSION['RheinaufCMS_User']) {
         $system->user = $_SESSION['RheinaufCMS_User'];
         $system->valid_user = true;
         return true;
     }
     $user = General::input_clean($_POST['user']);
     $pass = General::input_clean($_POST['pass']);
     $a = array();
     foreach ($system->user_tables as $t) {
         $sql = "SELECT * FROM `{$t}` WHERE `Login`='{$user}' AND `Password`='{$pass}'";
         $result = $system->connection->db_single_row($sql);
         if ($result) {
             break;
         }
     }
     if ($user && $pass && $result['Login'] == $user && $result['Password'] == $pass && $_SESSION['uuid'] == $_POST['uuid']) {
         $_SESSION['RheinaufCMS_User'] = $system->user = General::multi_unserialize($result);
         $_SESSION['RheinaufCMS_User']['user_found_in'] = $t;
         setcookie('RheinaufCMS_user', $user, 0, '/');
         $system->connection->db_update($t, array('last_login' => Date::now()), "id = '" . $result['id'] . "'");
         if (isset($_SESSION['RheinaufCMS_User'])) {
             $system->rechte = array();
             if ($_SESSION['RheinaufCMS_User']['Group'] == 'dev') {
                 $rechte = $system->connection->db_assoc("SELECT * FROM `RheinaufCMS>Rechte`");
                 for ($i = 0; $i < count($rechte); $i++) {
                     $system->rechte[] = $rechte[$i]['id'];
                 }
                 $_SESSION['RheinaufCMS_User']['allowed_actions'] = $system->rechte;
             } else {
                 $rechte = General::multi_unserialize($system->connection->db_single_row("SELECT * FROM `RheinaufCMS>Groups` WHERE `Name` ='" . $_SESSION['RheinaufCMS_User']['Group'] . "'"));
                 $_SESSION['RheinaufCMS_User']['allowed_actions'] = $system->rechte = $rechte['Rechte'];
             }
         }
         unset($_SESSION['uuid']);
         $system->valid_user = true;
         return true;
     } else {
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:52,代码来源:Login.php

示例9: sinceDate

 /**
  * Throws an deprecated exception if given date was before the
  * current date.
  *
  * If no message is given, an auto-generated message will be used
  * which contains type/method & location where this method has been
  * invoked - respectively the location of the deprecated code.
  *
  * @param string $namespace_
  * @param \Components\Date $date_
  * @param string $message_
  *
  * @throws \Components\Deprecated
  */
 public static function sinceDate($namespace_, Date $date_, $message_ = null)
 {
     // ignore for production.
     if (Environment::isLive()) {
         return;
     }
     if (Date::now()->isAfter($date_)) {
         if (null === $message_) {
             throw static::createDefaultException($namespace_);
         }
         throw new static($namespace_, $message_, null, true);
     }
 }
开发者ID:evalcodenet,项目名称:net.evalcode.components.type,代码行数:27,代码来源:deprecated.php

示例10: make_scaffold

 function make_scaffold()
 {
     if (!class_exists('FormScaffold')) {
         include_once 'FormScaffold.php';
     }
     $this->scaff = new FormScaffold('RheinaufCMS>Kalender>Termine', $this->connection);
     //$this->scaff->re_entry = true;
     $this->scaff->cols_array['UID']['type'] = 'hidden';
     $this->scaff->cols_array['UID']['value'] = $uniqid = $_POST['UID'] ? $_POST['UID'] : 'online_' . md5(uniqid(rand(), true));
     $this->scaff->cols_array['SUMMARY']['type'] = 'textarea';
     $this->scaff->cols_array['SUMMARY']['name'] = 'Zusammenfassung';
     $this->scaff->cols_array['SUMMARY']['required'] = true;
     $this->scaff->cols_array['SUMMARY']['attributes'] = array('rows' => '1', 'cols' => '80');
     $this->scaff->cols_array['DESCRIPTION']['name'] = 'Beschreibung';
     $this->scaff->cols_array['DESCRIPTION']['attributes'] = array('rows' => '10', 'cols' => '80');
     $this->scaff->cols_array['DESCRIPTION']['html'] = true;
     $this->scaff->cols_array['LOCATION']['name'] = 'Ort';
     $this->scaff->cols_array['LOCATION']['value'] = $_POST['LOCATION'] ? $_POST['LOCATION'] : 'Wachsfabrik';
     $this->scaff->cols_array['STATUS']['name'] = 'Status';
     $this->scaff->cols_array['STATUS']['type'] = 'select';
     $this->scaff->cols_array['STATUS']['value'] = $_POST['STATUS'] ? $_POST['STATUS'] : 'CONFIRMED';
     $this->scaff->cols_array['STATUS']['options'] = array('CONFIRMED' => 'fest', 'TENTATIVE' => 'vorläufig', 'CANCELLED' => 'storniert');
     $this->scaff->cols_array['CLASS']['name'] = 'Klassifizierung';
     $this->scaff->cols_array['CLASS']['type'] = 'select';
     $this->scaff->cols_array['CLASS']['value'] = $_POST['CLASS'] ? $_POST['CLASS'] : 'PUBLIC';
     $this->scaff->cols_array['CLASS']['options'] = array('PUBLIC' => 'öffentlich', 'PRIVATE' => 'nicht öffentlich');
     $this->scaff->cols_array['CATEGORIES']['name'] = 'Kategorie';
     $this->scaff->cols_array['CATEGORIES']['type'] = 'select';
     $this->scaff->cols_array['CATEGORIES']['required'] = true;
     $this->scaff->cols_array['CATEGORIES']['options'] = array();
     foreach ($this->connection->db_assoc("SELECT * FROM `RheinaufCMS>Kalender>Kategorien` ORDER BY `id`") as $category) {
         $this->scaff->cols_array['CATEGORIES']['options'][$category['Name']] = $category['Name'];
     }
     $this->scaff->cols_array['DTSTART']['name'] = 'Beginn';
     $this->scaff->cols_array['DTSTART']['type'] = 'timestamp';
     $this->scaff->cols_array['DTSTART']['required'] = true;
     $this->scaff->cols_array['DTSTART']['value'] = $_GET['new'] ? Date::unify_timestamp($_GET['new']) : '';
     $this->scaff->cols_array['DTEND']['name'] = 'Ende';
     $this->scaff->cols_array['DTEND']['type'] = 'timestamp';
     $this->scaff->cols_array['DTSTAMP']['type'] = 'hidden';
     $this->scaff->cols_array['DTSTAMP']['value'] = Date::now();
     $this->scaff->cols_array['X-RHEINAUF-LOGO']['type'] = 'ignore';
     $this->scaff->cols_array['X-RHEINAUF-BILD']['type'] = 'ignore';
     $this->scaff->cols_array['X-RHEINAUF-PREIS']['type'] = 'ignore';
     $this->scaff->cols_array['X-RHEINAUF-EVENT']['type'] = 'ignore';
     $this->scaff->cols_array['CONTACT']['name'] = 'Kontakt';
     $this->scaff->cols_array['CONTACT']['type'] = 'email';
     $this->scaff->cols_array['CONTACT']['value'] = '';
     $this->scaff->cols_array['X-OTHER-VCAL']['type'] = 'hidden';
     include 'Kalender/DefaultValues.php';
 }
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:51,代码来源:KalenderAdmin.php

示例11: saveRevision

 /**
 * Lorem ipsum.
 *
 * @param string $param1
 * @param bool   $param2 lorem ipsum
 * @param  string $param3 lorem ipsum
 *
 * @return int lorem ipsum
 */
 public function saveRevision(BaseCollection $old_data, $new_data = null, $options = [])
 {
     $table = $this->getRevisionsTableName();
     $entity = $this->collectionToRevisionEntity($old_data);
     $data = $entity->getData();
     $data = $this->filterFields($data);
     $uuid1 = Uuid::uuid1();
     $data['rev_id'] = $uuid1->toString();
     $data['rev_hash'] = $entity->hash();
     $data['rev_date'] = Date::now()->toSql();
     $data['rev_author'] = $this->user->getFullName();
     $status = $this->db->insert($table, $data);
     return $status;
 }
开发者ID:jakebathman,项目名称:sublimetext-codeformatter,代码行数:23,代码来源:test3.php

示例12: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     if ($this->sampleList === null) {
         $d1 = new Date(2012, 5, 21);
         $d2 = new Datetime(2012, 5, 21, 7, 30);
         $d3 = new Timestamp(2012, 5, 21, 7, 30, 9);
         $d4 = new Date(2012, 3, 7);
         $d5 = new Datetime(2012, 3, 7, 0, 0);
         $d6 = new Timestamp(2012, 3, 7, 0, 0, 0);
         $d7 = Date::now();
         $d8 = Datetime::now()->setAll(array("hour" => 8, "minute" => 6));
         $d9 = Timestamp::now()->setAll(array("hour" => 8, "minute" => 6, "second" => 4));
         $this->sampleList = array(new SimpleFormatTest_Sample("YmdHis", new SimpleFormatTest_ParseData("20120521073009", "2012052112345", $d1, $d2, $d3), new SimpleFormatTest_FormatData($d1, "20120521000000"), new SimpleFormatTest_FormatData($d2, "20120521073000"), new SimpleFormatTest_FormatData($d3, "20120521073009")), new SimpleFormatTest_Sample("Y年n月j日G時f分b秒", new SimpleFormatTest_ParseData("2012年5月21日7時30分9秒", "2012年05月21日07時30分09秒", $d1, $d2, $d3), new SimpleFormatTest_FormatData($d1, "2012年5月21日0時0分0秒"), new SimpleFormatTest_FormatData($d2, "2012年5月21日7時30分0秒"), new SimpleFormatTest_FormatData($d3, "2012年5月21日7時30分9秒")), new SimpleFormatTest_Sample("\\Y=Y \\n=n \\j=j \\H=H \\i=i \\s=s", new SimpleFormatTest_ParseData("Y=2012 n=5 j=21 H=07 i=30 s=09", "Y=2012 n=5 j=21 H=7 i=30 s=9", $d1, $d2, $d3), new SimpleFormatTest_FormatData($d1, "Y=2012 n=5 j=21 H=00 i=00 s=00"), new SimpleFormatTest_FormatData($d2, "Y=2012 n=5 j=21 H=07 i=30 s=00"), new SimpleFormatTest_FormatData($d3, "Y=2012 n=5 j=21 H=07 i=30 s=09")), new SimpleFormatTest_Sample("Y/m/d", new SimpleFormatTest_ParseData("2012/03/07", "2012-03-07", $d4, $d5, $d6), new SimpleFormatTest_FormatData($d1, "2012/05/21"), new SimpleFormatTest_FormatData($d2, "2012/05/21"), new SimpleFormatTest_FormatData($d3, "2012/05/21")), new SimpleFormatTest_Sample("Y.n.j", new SimpleFormatTest_ParseData("2012.3.7", "hogehoge", $d4, $d5, $d6), new SimpleFormatTest_FormatData($d1, "2012.5.21"), new SimpleFormatTest_FormatData($d2, "2012.5.21"), new SimpleFormatTest_FormatData($d3, "2012.5.21")), new SimpleFormatTest_Sample("H:i:s", new SimpleFormatTest_ParseData("08:06:04", "8:06:04", $d7, $d8, $d9), new SimpleFormatTest_FormatData($d1, "00:00:00"), new SimpleFormatTest_FormatData($d2, "07:30:00"), new SimpleFormatTest_FormatData($d3, "07:30:09")), new SimpleFormatTest_Sample("G時f分b秒", new SimpleFormatTest_ParseData("8時6分4秒", "8じ6分4秒", $d7, $d8, $d9), new SimpleFormatTest_FormatData($d1, "0時0分0秒"), new SimpleFormatTest_FormatData($d2, "7時30分0秒"), new SimpleFormatTest_FormatData($d3, "7時30分9秒")), new SimpleFormatTest_Sample("Y年n月j日(E)", new SimpleFormatTest_ParseData("2012年3月7日(水)", "2012年3月7日(無)", $d4, $d5, $d6), new SimpleFormatTest_FormatData($d1, "2012年5月21日(月)"), new SimpleFormatTest_FormatData($d2, "2012年5月21日(月)"), new SimpleFormatTest_FormatData($d3, "2012年5月21日(月)")));
     }
 }
开发者ID:trashtoy,项目名称:peach2,代码行数:19,代码来源:SimpleFormatTest.php

示例13: __construct

 /**
  * Constructor
  *
  * @param   var... parts
  */
 public function __construct()
 {
     $this->name = '';
     $args = func_get_args();
     foreach ($args as $part) {
         if ($part instanceof ZipDirEntry) {
             $this->name .= $part->getName();
         } else {
             $this->name .= strtr($part, '\\', '/') . '/';
         }
     }
     $this->name = rtrim($this->name, '/');
     $this->mod = Date::now();
     $this->compression = array(Compression::$NONE, 6);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:20,代码来源:ZipFileEntry.class.php

示例14: onRetrieveValue

 /**
  * @see \Components\Ui_Panel::onRetrieveValue() onRetrieveValue
  */
 protected function onRetrieveValue()
 {
     $params = $this->scriptlet->request->getParams();
     $id = $this->id();
     if ($params->containsKey("{$id}-date")) {
         $date = $params->get("{$id}-date");
     } else {
         $date = Date::now()->formatLocalized('common/date/pattern/short');
     }
     if ($params->containsKey("{$id}-time")) {
         $time = $params->get("{$id}-time");
     } else {
         $time = Date::now()->formatLocalized('common/time/pattern/short');
     }
     $this->value(Date::parse("{$date} {$time}", Timezone::systemDefault()));
 }
开发者ID:evalcodenet,项目名称:net.evalcode.components.ui,代码行数:19,代码来源:datetime.php

示例15: getNextVersion

 /**
  * Creates new version object relating on latest version
  *
  * @param   org.webdav.version.Webdav*Version
  * @param   io.File file
  * @return  org.webdav.version.Webdav*Version
  */
 public function getNextVersion($actVersion, $file)
 {
     // Load same type of version as before
     $obj = XPClass::forName(XP::typeOf($actVersion));
     // Get name of file, without extension
     $fname = basename($actVersion->getFilename(), '.' . $file->getExtension());
     // Get name of directory
     $dir = substr(dirname($actVersion->getHref()), 12);
     // Create new version object
     with($version = $obj->newInstance($actVersion->getFilename()));
     $version->setVersionNumber($actVersion->getVersionNumber() + 0.1);
     $version->setHref('../versions/' . $dir . '/' . $fname . '[' . $version->getVersionNumber() . '].' . $file->getExtension());
     $version->setVersionName($fname . '[' . $version->getVersionNumber() . '].' . $file->getExtension());
     $version->setContentLength($file->size());
     $version->setLastModified(Date::now());
     return $version;
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:24,代码来源:WebdavVersionUtil.class.php


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