Example #1
0
 public static function update_datetime()
 {
     DateTimeNow::$today = DateTime::format(DateTime::now(true), 'His');
     DateTimeNow::$today_first = DateTime::format(DateTime::now(true), 'Ymd000000');
     DateTimeNow::$today_last = DateTime::format(DateTime::now(true), 'Ymd235959');
     DateTimeNow::$today_hour = DateTime::format(DateTime::now(true), 'H0000');
 }
Example #2
0
File: Diff.php Project: wscore/site
 /**
  * Get the difference in seconds
  *
  * @param  DateTime  $dt
  * @param  boolean $abs Get the absolute of the difference
  *
  * @return integer
  */
 public function inSeconds(DateTime $dt = null, $abs = true)
 {
     $dt = $dt ?: DateTime::now();
     $value = $dt->getTimestamp() - $this->date->getTimestamp();
     return $abs ? abs($value) : $value;
 }
Example #3
0
 /**
  * @param string   $id
  * @param int      $playHead
  * @param Metadata $metadata
  * @param mixed    $payload
  *
  * @return DomainMessage
  */
 public static function recordNow($id, $playHead, Metadata $metadata, $payload)
 {
     return new DomainMessage($id, $playHead, $metadata, $payload, DateTime::now());
 }
Example #4
0
 public function testAddDay()
 {
     $this->assertEquals((new \DateTime())->modify('1 day'), DateTime::now()->addDay(1)->getNative());
     $this->assertNotEquals((new \DateTime())->modify('15 day'), DateTime::now()->addDay(1)->getNative());
 }