Projects/nettsiden-old
Projects
/
nettsiden-old
Archived
8
0
Fork 0

Global date formatting function

This commit is contained in:
Fredrik Lindberg Strupe 2016-08-26 23:14:46 +02:00
parent a4787387dd
commit f39389ead4
4 changed files with 10 additions and 3 deletions

View File

@ -20,6 +20,10 @@ class Agenda {
$this->activities = $activities; $this->activities = $activities;
} }
public static function getFormattedDate($date) {
return trim(strftime('%A %e. %b %H.%M', $date->getTimeStamp()));
}
public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) { public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) {
$results = []; $results = [];
for($i = 0; $i < sizeof($this->activities); $i++) { for($i = 0; $i < sizeof($this->activities); $i++) {

View File

@ -4,6 +4,7 @@ date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO'); setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../../src/_autoload.php'; require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php'; require __DIR__ . '/../../sql_config.php';
use \pvv\side\Agenda;
?> ?>
<html lang="no"> <html lang="no">
<title>Sosialverkstedet</title> <title>Sosialverkstedet</title>
@ -35,7 +36,7 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
<ul class="subtext"> <ul class="subtext">
<li>Tid: <li>Tid:
<strong> <strong>
<?= $nextEvent->getStart()->format('Y-m-d H:i');?> <?= Agenda::getFormattedDate($nextEvent->getStart());?>
</strong> </strong>
<li>Sted: <li>Sted:
<strong> <strong>

View File

@ -4,6 +4,7 @@ date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO'); setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../../src/_autoload.php'; require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php'; require __DIR__ . '/../../sql_config.php';
use \pvv\side\Agenda;
?> ?>
<html lang="no"> <html lang="no">
<title>Sosialverkstedet</title> <title>Sosialverkstedet</title>
@ -36,7 +37,7 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
<ul class="subtext"> <ul class="subtext">
<li>Tid: <li>Tid:
<strong> <strong>
<?= $nextEvent->getStart()->format('Y-m-d H:i');?> <?= Agenda::getFormattedDate($nextEvent->getStart());?>
</strong> </strong>
<li>Sted: <li>Sted:
<strong> <strong>

View File

@ -4,6 +4,7 @@ date_default_timezone_set('Europe/Oslo');
setlocale(LC_ALL, 'no_NO'); setlocale(LC_ALL, 'no_NO');
require __DIR__ . '/../../src/_autoload.php'; require __DIR__ . '/../../src/_autoload.php';
require __DIR__ . '/../../sql_config.php'; require __DIR__ . '/../../sql_config.php';
use \pvv\side\Agenda;
?> ?>
<html lang="no"> <html lang="no">
<title>Sosialverkstedet</title> <title>Sosialverkstedet</title>
@ -37,7 +38,7 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
<ul class="subtext"> <ul class="subtext">
<li>Tid: <li>Tid:
<strong> <strong>
<?= $nextEvent->getStart()->format('Y-m-d H:i');?> <?= Agenda::getFormattedDate($nextEvent->getStart());?>
</strong> </strong>
<li>Sted: <li>Sted:
<strong> <strong>