本文整理汇总了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]);
}
示例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
}
}
}
示例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);
}
示例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'));
}
示例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]);
}
示例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]);
}
示例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'));
}
示例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;
}
示例9: getCreatedPlanAttribute
public function getCreatedPlanAttribute()
{
$date = new Date($this->created_at);
return $date->format('l j F Y');
}
示例10: getTimezone
/**
* Return the abbreviated timezone.
*
* @return string
*/
public function getTimezone()
{
$dateTime = new Date();
$dateTime->setTimeZone(new DateTimeZone($this->cachetTimezone));
return $dateTime->format('T');
}
示例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));
}
示例12: humanDate
function humanDate($date)
{
$date = new Date($date);
return $date->format('j F, Y');
}
示例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()]);
}
示例14: getCreatedBudgetAttribute
public function getCreatedBudgetAttribute()
{
$date = new Date($this->created_at);
return $date->format('l j F Y H:i:s');
}
示例15: getUpdatedBudgetAttribute
public function getUpdatedBudgetAttribute()
{
$date = new Date($this->updated_at);
return $date->format('l j F Y');
}