Serpentine
Spungjund
Hallo Leute,
habe mir eine Klasse gebastelt um schnell datetime stamps umzuwandeln und als array auszugeben und die aktuelle Zeit als array auszugeben, aber leider geben die Funktionen gar nichts aus.
Ich kann noch nicht einmal mit einer Funktion $this->year o.Ä. ausgeben.
Ich benutze zu testzwecken xampp für Windows.
habe mir eine Klasse gebastelt um schnell datetime stamps umzuwandeln und als array auszugeben und die aktuelle Zeit als array auszugeben, aber leider geben die Funktionen gar nichts aus.
Ich kann noch nicht einmal mit einer Funktion $this->year o.Ä. ausgeben.
Ich benutze zu testzwecken xampp für Windows.
PHP:
<?php
class mysql_time
{
private $day;
private $month;
private $year;
private $hour;
private $minute;
private $current_time;
private $buffer;
public function __construct($value='2009-04-22 17:15:46') {
$this->day = substr($value, -11, -9);
$this->month = substr($value, -14, -12);
$this->year = substr($value, 0, -15);
$this->hour = substr($value, -8, -6);
$this->minute = substr($value, -5, -3);
}
public function getasarray() {
$buffer = array(
"day" => $this->day,
"month" => $this->month,
"year" => $this->year,
"hour" => $this->hour,
"minute" => $this->minute);
return $buffer;
}
public function getordered() {
return $this->day.'.'.$this->month.'.'.$this->year.' '.$this->hour.':'.$this->minute;
}
public function getcurrent() {
$this->current_time = date(YmdHis);
$this->day = substr($this->current_time, -8, -6);
$this->month = substr($this->current_time, -10, -8);
$this->year = substr($this->current_time, 0, -10);
$this->hour = substr($this->current_time, -6, -4);
$this->minute = substr($this->current_time, -4, -2);
$buffer = array(
"day" => $this->day,
"month" => $this->month,
"year" => $this->year,
"hour" => $this->hour,
"minute" => $this->minute);
return $buffer;
}
public function __destruct() {
}
}
?>