format() публичный Метод

Returns date formatted according to given or predefined format.
public format ( string $format ) : string
$format string
Результат string
Пример #1
1
 public function getUpdatedBudgetAttribute()
 {
     $date = new Date($this->updated_at);
     return $date->format('l j F Y');
 }
 /**
  * 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]);
 }
Пример #3
0
 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
         }
     }
 }
Пример #4
0
 /**
  * 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);
 }
Пример #5
0
 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'));
 }
 /**
  * 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]);
 }
 /**
  * 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]);
 }
Пример #8
0
 /**
  * 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'));
 }
Пример #9
0
 /**
  * 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;
 }
Пример #10
0
 public function getCreatedPlanAttribute()
 {
     $date = new Date($this->created_at);
     return $date->format('l j F Y');
 }
Пример #11
0
 /**
  * Return the abbreviated timezone.
  *
  * @return string
  */
 public function getTimezone()
 {
     $dateTime = new Date();
     $dateTime->setTimeZone(new DateTimeZone($this->cachetTimezone));
     return $dateTime->format('T');
 }
Пример #12
0
 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));
 }
Пример #13
0
function humanDate($date)
{
    $date = new Date($date);
    return $date->format('j F, Y');
}
Пример #14
0
 /**
  * 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()]);
 }
Пример #15
0
 public function getCreatedBudgetAttribute()
 {
     $date = new Date($this->created_at);
     return $date->format('l j F Y H:i:s');
 }
Пример #16
0
 function get_date_month($input)
 {
     //Date::setLocale('th');
     $create_date = new Date($input);
     return $create_date->format('m');
 }