20 lines
360 B
PHP
20 lines
360 B
PHP
<?php
|
|
class DateFormatter {
|
|
const DEFAULT_FORMAT = 'l Y-m-d';
|
|
|
|
public $format;
|
|
public $time;
|
|
|
|
public function __construct() {
|
|
if (!empty($_REQUEST['apply'])) {
|
|
$this->format = $_REQUEST['format'];
|
|
}
|
|
else {
|
|
$this->format = self::DEFAULT_FORMAT;
|
|
}
|
|
}
|
|
|
|
public function date() {
|
|
return date($this->format, time());
|
|
}
|
|
}
|