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


PHP Date::format方法代码示例

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


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

示例1: home

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function home()
 {
     $lastNews = News::orderBy('id', 'desc')->first();
     $lastNews->description = $this::text_humanized($lastNews->description);
     Date::setLocale('fr');
     $date = new Date($lastNews->when);
     $lastNews->when = $date->format('l j F Y');
     $lastNews->hour = $date->format('H:i');
     return view('page/home', ['news' => $lastNews]);
 }
开发者ID:AxelCardinaels,项目名称:CbSeraing-Laravel,代码行数:15,代码来源:PagesController.php

示例2: testTranslatesDays

 public function testTranslatesDays()
 {
     $days = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
     foreach ($this->languages as $language) {
         $translations = (include "src/lang/{$language}/date.php");
         foreach ($days as $day) {
             $date = new Date($day);
             $date->setLocale($language);
             $this->assertTrue(isset($translations[$day]));
             $this->assertEquals($translations[$day], $date->format('l'), "Language: {$language}");
             // Full
             $this->assertEquals(substr($translations[$day], 0, 3), $date->format('D'), "Language: {$language}");
             // Short
         }
     }
 }
开发者ID:erpio,项目名称:Reportula,代码行数:16,代码来源:TranslationTest.php

示例3: format

 /**
  * Returns date formatted according to given format.
  * @param string $format
  * @return string
  * @link http://php.net/manual/en/datetime.format.php
  */
 public function format($format)
 {
     if (self::$jalali == false) {
         // dd(self::$jalali);
     }
     if (self::$jalali === true) {
         return $this->eDateTime->date($format, $this->getTimeStamp());
     }
     return parent::format($format);
 }
开发者ID:sajjad-ser,项目名称:oc-persian,代码行数:16,代码来源:Argon.php

示例4: testFormatTranslated

 public function testFormatTranslated()
 {
     Date::setLocale('nl');
     $date = new Date(1367186296);
     $this->assertSame('zondag 28 april 2013 21:58:16', $date->format('l j F Y H:i:s'));
     $date = new Date(1367186296);
     $this->assertSame('l 28 F 2013 21:58:16', $date->format('\\l j \\F Y H:i:s'));
     $date = new Date(1367186296);
     $this->assertSame('zon 28 apr 2013 21:58:16', $date->format('D j M Y H:i:s'));
 }
开发者ID:erpio,项目名称:Reportula,代码行数:10,代码来源:DateTest.php

示例5: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $categories = ForumCategories::all();
     $categorie = ForumCategories::where('slug', $id)->first();
     foreach ($categorie->subjects as $subject) {
         Date::setLocale('fr');
         $date = new Date($subject->created);
         $subject->when = $date->format('j F Y');
     }
     return view('forum.categorie.show', ['categorie' => $categorie]);
 }
开发者ID:AxelCardinaels,项目名称:CbSeraing-Laravel,代码行数:17,代码来源:ForumCategoriesController.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $sujet = ForumSubjects::where("id", $id)->first();
     $categorie = ForumCategories::find($sujet->category);
     foreach ($sujet->messages as $message) {
         Date::setLocale('fr');
         $date = new Date($message->created);
         $message->when = $date->format('j F Y');
         $message->message = $this::text_humanized($message->message);
         $message->message = BBCode::parse($message->message);
     }
     return view('forum.sujets.show', ['categorie' => $categorie, "sujet" => $sujet]);
 }
开发者ID:AxelCardinaels,项目名称:CbSeraing-Laravel,代码行数:19,代码来源:ForumSujetsController.php

示例7: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $album = Albums::find($id);
     $date = new Date('now', 'Europe/Brussels');
     $date->month = $album->mois + 1;
     $album->mois = $date->format('F');
     $proprietaire = User::find($album->ID_proprietaire);
     $album->proprietaire_nom = $proprietaire->first_name . ' ' . $proprietaire->last_name . ' (Propriétaire)';
     $picturesData = $album->pictures;
     $pictures = array();
     $i = 0;
     foreach ($picturesData as $picture) {
         $pictures[$i]['big'] = $picture->directory . '/' . $picture->name;
         $pictures[$i]['thumb'] = $picture->directory . '/thumb2_' . $picture->name;
         $i++;
     }
     return view('albums.show', compact('album', 'pictures'));
 }
开发者ID:nemsraiden,项目名称:imagiz,代码行数:24,代码来源:AlbumsController.php

示例8: getSubscribers

 /**
  * Fetches all of the subscribers over the last 30 days.
  *
  * @return \Illuminate\Support\Collection
  */
 protected function getSubscribers()
 {
     $allSubscribers = Subscriber::whereBetween('created_at', [$this->startDate->copy()->subDays(30)->format('Y-m-d') . ' 00:00:00', $this->startDate->format('Y-m-d') . ' 23:59:59'])->orderBy('created_at', 'desc')->get()->groupBy(function (Subscriber $incident) {
         return (new Date($incident->created_at))->setTimezone($this->dateTimeZone)->toDateString();
     });
     // Add in days that have no incidents
     foreach (range(0, 30) as $i) {
         $date = (new Date($this->startDate))->setTimezone($this->dateTimeZone)->subDays($i);
         if (!isset($allSubscribers[$date->toDateString()])) {
             $allSubscribers[$date->toDateString()] = [];
         }
     }
     // Sort the array so it takes into account the added days
     $allSubscribers = $allSubscribers->sortBy(function ($value, $key) {
         return strtotime($key);
     }, SORT_REGULAR, false);
     return $allSubscribers;
 }
开发者ID:practico,项目名称:Cachet,代码行数:23,代码来源:DashboardController.php

示例9: getCreatedPlanAttribute

 public function getCreatedPlanAttribute()
 {
     $date = new Date($this->created_at);
     return $date->format('l j F Y');
 }
开发者ID:juan2ramos,项目名称:agroseller,代码行数:5,代码来源:PlanProvider.php

示例10: getTimezone

 /**
  * Return the abbreviated timezone.
  *
  * @return string
  */
 public function getTimezone()
 {
     $dateTime = new Date();
     $dateTime->setTimeZone(new DateTimeZone($this->cachetTimezone));
     return $dateTime->format('T');
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:11,代码来源:DateFactory.php

示例11: Date

 function getDB_TBL_MEMBER_BENEFITS_bysearch_table($month, $year, $monthend, $yearend)
 {
     $dateStart = new Date($year . "-" . $month . "-1");
     $dateEnd = new Date($yearend . "-" . $monthend . "-1");
     $datenextmont = date("Y-m-d", strtotime("+1 month", strtotime($dateEnd)));
     $dateEndreal = new Date(date("Y", strtotime($datenextmont)) . "-" . date("m", strtotime($datenextmont)) . "-1");
     $sql2 = "SELECT  * FROM  TBL_MEMBER_BENEFITS WHERe RECORD_DATE BETWEEN '" . $dateStart->format('Y-m-d') . "' AND  '" . $dateEndreal->format('Y-m-d') . "' AND EMP_ID = " . get_userID() . " ORDER BY RECORD_DATE DESC";
     return DB::select(DB::raw($sql2));
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:9,代码来源:TrendsController.php

示例12: humanDate

function humanDate($date)
{
    $date = new Date($date);
    return $date->format('j F, Y');
}
开发者ID:kholidfu,项目名称:gludhag,代码行数:5,代码来源:helpers.php

示例13: view

 /**
  * Exibe o feed de notícias
  * @method view
  * @return html
  */
 public function view()
 {
     $date = new Date($this->getInfo('lastBuildDate'));
     return view('rsslist', ['title' => $this->getInfo('title'), 'description' => $this->getInfo('description'), 'link' => $this->getInfo('link'), 'date' => $date->format('d \\d\\e F \\d\\e Y') . ', às ' . $date->format('H:i:s'), 'items' => $this->getItems()]);
 }
开发者ID:harrysbaraini,项目名称:globofeed,代码行数:10,代码来源:RssController.php

示例14: getCreatedBudgetAttribute

 public function getCreatedBudgetAttribute()
 {
     $date = new Date($this->created_at);
     return $date->format('l j F Y H:i:s');
 }
开发者ID:juan2ramos,项目名称:agroseller,代码行数:5,代码来源:Budget.php

示例15: getUpdatedBudgetAttribute

 public function getUpdatedBudgetAttribute()
 {
     $date = new Date($this->updated_at);
     return $date->format('l j F Y');
 }
开发者ID:juan2ramos,项目名称:agroseller,代码行数:5,代码来源:Order.php


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