Ejemplo n.º 1
0
 /**
  * Date から Timestamp へのキャストをテストします.
  * 生成されたオブジェクトについて, 以下の点を確認します.
  * 
  * - 年・月・日のフィールドが元のオブジェクトのものと等しい
  * - 時・分・秒のフィールドが 0 になっている
  * 
  * @covers Peach\DT\Date::toTimestamp
  */
 public function testToTimestamp()
 {
     $d1 = new Date(2012, 5, 21);
     $this->assertEquals(new Timestamp(2012, 5, 21, 0, 0, 0), $d1->toTimestamp());
 }
Ejemplo n.º 2
0
 /**
  * 指定された Date オブジェクトを書式化します.
  * @param  Date $d 書式化対象の時間オブジェクト
  * @return string  このフォーマットによる文字列表現
  */
 public function formatDate(Date $d)
 {
     return $this->formatTimestamp($d->toTimestamp());
 }