/** * Return a date time formatted into the database's datetime format. * * @param DateTime $datetime The DateTime object * @return string */ public function datetimeToString($datetime) { return $datetime->format(static::$datetime_format); }
public function test_datetime_values_get_converted_to_strings() { $now = new DateTime(); $a = $this->_a(array('only' => 'created_at'), new Author(array('created_at' => $now))); $this->assert_equals($now->format(ActiveRecord\Serialization::$DATETIME_FORMAT), $a['created_at']); }
public function test_datetime_values_get_converted_to_strings() { $now = new DateTime(); $a = $this->_a(array('only' => 'created_at'), new Author(array('created_at' => $now))); $this->assert_equals($now->format(ActiveRecord\Config::instance()->get_date_format()), $a['created_at']); }