本文整理汇总了PHP中Jenssegers\Date\Date类的典型用法代码示例。如果您正苦于以下问题:PHP Date类的具体用法?PHP Date怎么用?PHP Date使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Date类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: build
public function build()
{
$translator = $this->processor->getTranslator();
$html = "";
Date::setLocale($this->locale);
if ($this->printStyles) {
$html .= $this->getStylesHtml();
}
$hidden = $this->isModal ? ' style="display:none;"' : '';
if ($this->printFrame) {
$html .= '<div id="changemodal-wrapper"' . $hidden . '><div id="changemodal"' . $hidden . '><div id="changemodal-frame"><h1>' . $this->title . '</h1>';
if ($this->isModal) {
$html .= '<i id="close-button" class="fa fa-times"></i>';
}
} else {
$html .= '<div id="changemodal">';
}
$html .= '<div class="changelog">';
try {
foreach ($this->processor->getVersions() as $version) {
$html .= '<h2 id="' . $version->getVersion() . '"';
if ($version->isYanked()) {
$html .= ' class="yanked" title="' . $translator->translateTo('This release has been yanked.') . '"';
}
$html .= '>' . $version->getVersion() . '</h2>';
if ($version->isReleased() && $version->getReleaseDate() !== null) {
$date = new Date($version->getReleaseDate()->getTimestamp());
$html .= '<h3 title="' . '">' . $date->ago();
if ($this->printDownloadLinks && !$version->isYanked()) {
$html .= ' <a href="' . $version->getUrl() . '" target="_blank"><i class="fa fa-download"></i></a>';
}
$html .= '</h3>';
}
$html .= '<div class="version-wrapper">';
foreach ($version->getChanges() as $label => $changes) {
$html .= '<ul class="' . $label . '">';
foreach ($changes as $change) {
$html .= '<li data-label="' . ucfirst($translator->translateTo($label)) . '">' . $change . '</li>';
}
$html .= '</ul>';
}
$html .= '</div>';
}
} catch (\Exception $e) {
$html .= '<div class="alert alert-danger" style="text-align: center" role="alert">' . '<i class="fa fa-lg fa-exclamation-triangle"></i><br>' . '<b>Could not get Changelog!</b><br>' . 'Error: <em>' . $e->getMessage() . '</em>' . '</div>';
}
$html .= '</div></div>';
if ($this->printFrame) {
$html .= '</div>';
}
if ($this->printScripts) {
$html .= $this->getScriptsHtml();
}
return $html;
}
开发者ID:Syonix,项目名称:changelog-viewer,代码行数:55,代码来源:HtmlFormatter.php
示例3: 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
示例4: 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
示例5: testConvert
/**
* @covers ::convert
*/
public function testConvert()
{
$test1 = Converter::convert(Calends::create(0, 'unix'));
$this->assertEquals(['start' => Date::createFromTimestamp(0), 'duration' => \Carbon\CarbonInterval::seconds(0), 'end' => Date::createFromTimestamp(0)], $test1);
$test2 = Converter::convert(Calends::create(['start' => 0, 'end' => 86400], 'unix'));
$this->assertEquals(['start' => Date::createFromTimestamp(0), 'duration' => \Carbon\CarbonInterval::seconds(86400), 'end' => Date::createFromTimestamp(86400)], $test2);
}
开发者ID:danhunsaker,项目名称:calends,代码行数:10,代码来源:DateTest.php
示例6: 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
示例7: handle
/**
* Handle the report incident command.
*
* @param \CachetHQ\Cachet\Commands\Incident\ReportIncidentCommand $command
*
* @return \CachetHQ\Cachet\Models\Incident
*/
public function handle(ReportIncidentCommand $command)
{
$data = ['name' => $command->name, 'status' => $command->status, 'message' => $command->message, 'visible' => $command->visible];
// Link with the component.
if ($command->component_id) {
$data['component_id'] = $command->component_id;
}
// The incident occurred at a different time.
if ($command->incident_date) {
$incidentDate = Date::createFromFormat('d/m/Y H:i', $command->incident_date, config('cachet.timezone'))->setTimezone(Config::get('app.timezone'));
$data['created_at'] = $incidentDate;
$data['updated_at'] = $incidentDate;
}
// Create the incident
$incident = Incident::create($data);
// Update the component.
if ($command->component_id) {
Component::find($command->component_id)->update(['status' => $command->component_status]);
}
// Notify subscribers.
if ($command->notify) {
event(new IncidentWasReportedEvent($incident));
}
return $incident;
}
开发者ID:ryanwinchester-forks,项目名称:Cachet,代码行数:32,代码来源:ReportIncidentCommandHandler.php
示例8: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
Date::setLocale('th');
$user = Auth::user();
$jobapps = Jobapp::all();
return view('hr.jobapps.index', compact('jobapps', 'user'));
}
开发者ID:kokzilla,项目名称:ipms2,代码行数:12,代码来源:JobappsController.php
示例9: getInsert
public function getInsert()
{
//if(Input::old('tanggal')!="" and Input::old('nis')!="") {
$siswa = \DB::table('t_siswa_tingkat')->where('nis', Input::old('nis'))->first();
if ($siswa == null) {
\Session::flash('siswa_ilang', 'NIS tidak ditemukan');
return redirect('/home');
}
$date = Date::createFromFormat('Y-m-d', Input::old('tanggal'));
$tapel = AbsencesController::checkPeriode($date);
$tapel['kd_tapel'] = \DB::table('t_tahun_ajaran')->where('tahun_ajaran', $tapel['tahun_ajaran'])->first()->kd_tahun_ajaran;
$siswa_tingkat = \DB::table('t_siswa_tingkat')->where('nis', $siswa->nis)->where('kd_tahun_ajaran', $tapel['kd_tapel'])->where('kd_periode_belajar', $tapel['periode'])->first();
if ($siswa_tingkat == null) {
\Session::flash('tahun_ajaran', 'Tahun ajaran belum dimulai');
return redirect('/home');
}
$siswa = \DB::table('t_siswa')->where('nis', $siswa->nis)->first();
$pikets = \DB::table('t_piket')->where('hari', $date->format('l'))->first();
$piket = \DB::table('t_guru')->where('kd_guru', $pikets->kd_guru)->first();
$jam_masuk = Date::createFromFormat('H:i:s', $pikets->jam_masuk, Date::now()->tzName);
return view('absences.insert', compact('date', 'jam_masuk', 'siswa', 'siswa_tingkat', 'piket', 'tapel'));
//}
//else
// return redirect('home');
}
开发者ID:rizkidoank,项目名称:smansa-absensi,代码行数:25,代码来源:AbsencesController.php
示例10: home
public function home()
{
$page_title = "لوحة التحكم";
$section_title = "لوحة التحكم";
Date::setLocale('ar');
$date = Date::now()->format('j F Y');
$day = Date::now()->format('l');
$month = Date::now()->format('F');
$year = Date::now()->format('Y');
//**************Tasks***************
$tasksToday = Task::orderBy('task_date', 'desc')->today()->take(5);
$tasksWeek = Task::orderBy('task_date', 'desc')->thisweek()->take(5);
$tasksMonth = Task::orderBy('task_date', 'desc')->thisMonth()->take(5);
$tasks_count = count($tasksToday->toArray());
//**************Fails***************
$failsToday = Failure::orderBy('fail_time', 'desc')->today()->take(5);
$failsWeek = Failure::orderBy('fail_time', 'desc')->thisweek()->take(5);
$failsMonth = Failure::orderBy('fail_time', 'desc')->thisMonth()->take(5);
$fails_count = count($failsToday->toArray());
//**************Repairs***************
$repairsToday = Repair::today();
$repairsWeek = Repair::thisweek();
$repairsMonth = Repair::thisMonth();
$repairs_count = count($repairsToday->toArray());
return view('dashboard.dashboard', compact('page_title', 'section_title', 'date', 'day', 'month', 'year', 'tasksToday', 'tasksMonth', 'tasksWeek', 'tasks_count', 'failsToday', 'failsMonth', 'failsWeek', 'fails_count', 'repairsToday', 'repairsMonth', 'repairsWeek', 'repairs_count'));
}
开发者ID:ashraf2033,项目名称:maintainit,代码行数:26,代码来源:PagesController.php
示例11: convertToPHPValue
public function convertToPHPValue($value, AbstractPlatform $platform)
{
$result = parent::convertToPHPValue($value, $platform);
if ($result instanceof \DateTime) {
return Date::instance($result);
}
return $result;
}
开发者ID:zetta-code,项目名称:tss-doctrineutil,代码行数:8,代码来源:JenssegersDateTimeType.php
示例12: handle
/**
* Handle the report maintenance command.
*
* @param \CachetHQ\Cachet\Commands\Incident\ReportMaintenanceCommand $command
*
* @return \CachetHQ\Cachet\Models\Incident
*/
public function handle(ReportMaintenanceCommand $command)
{
$scheduledAt = Date::createFromFormat('d/m/Y H:i', $command->timestamp, config('cachet.timezone'))->setTimezone(Config::get('app.timezone'));
$maintenanceEvent = Incident::create(['name' => $command->name, 'message' => $command->message, 'scheduled_at' => $scheduledAt, 'status' => 0, 'visible' => 1]);
// Notify subscribers.
event(new MaintenanceWasScheduledEvent($maintenanceEvent));
return $maintenanceEvent;
}
开发者ID:ryanwinchester-forks,项目名称:Cachet,代码行数:15,代码来源:ReportMaintenanceCommandHandler.php
示例13: showText
private function showText($request)
{
$texts = Text::with('user', 'question')->where('question_id', $request->question_id)->get(['created_at', 'user_id', 'description', 'question_id']);
foreach ($texts as $text) {
$text['date'] = Date::parse($text->created_at)->diffForHumans();
}
return ['text' => $texts];
}
开发者ID:juan2ramos,项目名称:agroseller,代码行数:8,代码来源:QuestionController.php
示例14: 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
示例15: index
function index(Request $request, $id)
{
if (auth()->user()->role_id == 3) {
$plan = PlanProvider::where('provider_id', auth()->user()->provider->id)->orderBy('created_at', 'DESC')->first();
$finalPlan = new Date();
if ($plan) {
$date = new Date($plan->created_at);
$finalPlan = $date->addMonths($plan->period);
}
if (new Date() >= $finalPlan) {
PlanProvider::create(['provider_id' => auth()->user()->provider->id, 'name' => $request->name, 'description' => $request->description, 'period' => $request->period, 'price' => $request->price]);
return redirect()->route('inactivePlan');
}
return redirect()->route('admin')->with(['message' => "Usted ya ha comprado un plan. Este finaliza el día {$finalPlan}"]);
} else {
return redirect()->route('admin')->with('messageError', 1);
}
}
开发者ID:juan2ramos,项目名称:agroseller,代码行数:18,代码来源:PayController.php
示例16: 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
示例17: renderHtml
public function renderHtml()
{
if ($this->_response) {
$data = [];
foreach ($this->_response as $tweet) {
$data[] = ['userImage' => $tweet->user->profile_image_url, 'userName' => $tweet->user->name, 'created' => Date::parse($tweet->created_at)->ago(), 'text' => StrHelper::removeEmoji($tweet->text), 'source' => $tweet->source];
}
return Application::getInstance()->jadeEngine()->render(Application::getInstance()->getBasePath() . '/frontend/src/jade/resource/twitter.jade', ['data' => $data]);
}
}
开发者ID:petun,项目名称:ipad-slider,代码行数:10,代码来源:TwitterResourceHandler.php
示例18: today
function today()
{
global $today;
if (!isset($today)) {
$today = Date::now();
$today->hour = 0;
$today->minute = 0;
$today->second = 0;
}
return $today;
}
开发者ID:ankhzet,项目名称:Ankh,代码行数:11,代码来源:view.php
示例19: handle
/**
* Handle the report maintenance command.
*
* @param \CachetHQ\Cachet\Commands\Incident\ReportMaintenanceCommand $command
*
* @return \CachetHQ\Cachet\Models\Incident
*/
public function handle(ReportMaintenanceCommand $command)
{
// TODO: Add validation to scheduledAt
$scheduledAt = Date::createFromFormat('d/m/Y H:i', $command->timestamp, Setting::get('app_timezone'))->setTimezone(Config::get('app.timezone'));
$maintenanceEvent = Incident::create(['name' => $command->name, 'message' => $command->message, 'scheduled_at' => $scheduledAt, 'status' => 0, 'visible' => 1]);
// Notify subscribers.
if ($command->notify) {
event(new MaintenanceWasScheduledEvent($maintenanceEvent));
}
return $maintenanceEvent;
}
开发者ID:practico,项目名称:Cachet,代码行数:18,代码来源:ReportMaintenanceCommandHandler.php
示例20: reloadQuestions
private function reloadQuestions($id)
{
$questions = Question::where('product_id', $id)->orderBy('created_at', 'DESC')->get();
foreach ($questions as $question) {
$question['texts'] = Text::with('user')->where('question_id', $question->id)->get();
foreach ($question->texts as $text) {
$text['date'] = Date::parse($text->created_at)->diffForHumans();
}
}
return $questions;
}
开发者ID:juan2ramos,项目名称:agroseller,代码行数:11,代码来源:ProductController.php
注:本文中的Jenssegers\Date\Date类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论