system/Model.php
protected function setDate(int $userData = null)
	{
		$currentDate = is_numeric($userData) ? (int) $userData : time();

		switch ($this->dateFormat)
		{
			case 'int':
				return $currentDate;
				break;
			case 'datetime':
				return date('Y-m-d H:i:s', $currentDate);
				break;
			case 'date':
				return date('Y-m-d', $currentDate);
				break;
		}
	}
protected function setDate(int $userData = null)
	{
		$currentDate = is_numeric($userData) ? (int) $userData : time();

		switch ($this->dateFormat)
		{
			case 'int':
				return $currentDate;
				break;
			case 'datetime':
				return date('Y-m-d H:i:s', $currentDate);
				break;
			case 'date':
				return date('Y-m-d', $currentDate);
				break;
		}
	}
A utility function to allow child models to use the type of
date/time format that they prefer. This is primarily used for
setting created_at and updated_at values, but can be used
by inheriting classes.

The available time formats are:
- 'int'      - Stores the date as an integer timestamp
- 'datetime' - Stores the data in the SQL datetime format
- 'date'     - Stores the date (only) in the SQL date format.

@param integer $userData An optional PHP timestamp to be converted.

@return mixed