Skip to content

Instantly share code, notes, and snippets.

@eb-eoliveira
Created March 26, 2013 11:13
Show Gist options
  • Save eb-eoliveira/5244648 to your computer and use it in GitHub Desktop.
Save eb-eoliveira/5244648 to your computer and use it in GitHub Desktop.
/**
* Set sent at now.
*
* @return ItemSent
*/
public function setSentAtNow()
{
return $this->setSentAt(new \DateTime());
}
/**
* Set sent at.
*
* @param \DateTime $sentAt Sent at.
*
* @return ItemSent
*/
public function setSentAt(\DateTime $sentAt)
{
$this->set(self::KEY_SENT_AT, $sentAt->getTimestamp());
return $this;
}
/**
* Return set at.
*
* @return \DateTime
*/
public function getSentAt()
{
return (
(new \DateTime())->setTimestamp($this->get(self::KEY_SENT_AT))
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment