final private function setDatetimeProperty($propertyName, $value) {
		
		$app = Application::getInstance();
		
		// in login page the currentUser doesn’t exist
		if (is_a($app->currentUser, 'User')) {
			$dtz = $app->currentUser->getDateTimeZone();
		} else {
			$dtz = new \DateTimeZone(BASE_TIMEZONE);
		}
		
		// timestamp is acquired in UTC only, any DTZ doesn't affect its value
		if (defined('UTC_DATE') and UTC_DATE and (is_int($value) or ctype_digit($value))) {

			$this->$propertyName = new \DateTime('@' . (int)$value);
			$this->$propertyName->setTimezone($dtz);
			
		// data generic string datetime or date
		} else if (is_string($value)) {
			
			if (in_array($value, ['0000-00-00 00:00:00','0000-00-00',''])) {

				$this->$propertyName = NULL;

			}  else {

				// acquired as current user timezone
				try {
					$this->$propertyName = new \DateTime($value, $dtz);
				} catch (\Exception $e) {
					$this->$propertyName = NULL;
					$this->addError($e->getMessage());
				}
				
			}
			
		// already DateTime object
		} else if (is_a($value, 'DateTime')) {

			// sets the user current tz and assigns
			$value->setTimeZone($dtz);
			$this->$propertyName = $value;

		// no recognized type/format
		} else {

			//$app->logWarning('Unrecognized date variable for ' . $propertyName . ' type ' . gettype($value) . ' having value ' . Utilities::varToText($value));
			$this->$propertyName = NULL;
			
		}
		
	}
final private function setDatetimeProperty($propertyName, $value) {
		
		$app = Application::getInstance();
		
		// in login page the currentUser doesn’t exist
		if (is_a($app->currentUser, 'User')) {
			$dtz = $app->currentUser->getDateTimeZone();
		} else {
			$dtz = new \DateTimeZone(BASE_TIMEZONE);
		}
		
		// timestamp is acquired in UTC only, any DTZ doesn't affect its value
		if (defined('UTC_DATE') and UTC_DATE and (is_int($value) or ctype_digit($value))) {

			$this->$propertyName = new \DateTime('@' . (int)$value);
			$this->$propertyName->setTimezone($dtz);
			
		// data generic string datetime or date
		} else if (is_string($value)) {
			
			if (in_array($value, ['0000-00-00 00:00:00','0000-00-00',''])) {

				$this->$propertyName = NULL;

			}  else {

				// acquired as current user timezone
				try {
					$this->$propertyName = new \DateTime($value, $dtz);
				} catch (\Exception $e) {
					$this->$propertyName = NULL;
					$this->addError($e->getMessage());
				}
				
			}
			
		// already DateTime object
		} else if (is_a($value, 'DateTime')) {

			// sets the user current tz and assigns
			$value->setTimeZone($dtz);
			$this->$propertyName = $value;

		// no recognized type/format
		} else {

			//$app->logWarning('Unrecognized date variable for ' . $propertyName . ' type ' . gettype($value) . ' having value ' . Utilities::varToText($value));
			$this->$propertyName = NULL;
			
		}
		
	}
final private function setDatetimeProperty ( $ propertyName , $ value ) { $ app = Application :: getInstance ( ) ; // in login page the currentUser doesn’t exist if ( is_a ( $ app -> currentUser , 'User' ) ) { $ dtz = $ app -> currentUser -> getDateTimeZone ( ) ; } else { $ dtz = new \ DateTimeZone ( BASE_TIMEZONE ) ; } // timestamp is acquired in UTC only, any DTZ doesn't affect its value if ( defined ( 'UTC_DATE' ) and UTC_DATE and ( is_int ( $ value ) or ctype_digit ( $ value ) ) ) { $ this -> $ propertyName = new \ DateTime ( '@' . ( int ) $ value ) ; $ this -> $ propertyName -> setTimezone ( $ dtz ) ; // data generic string datetime or date } else if ( is_string ( $ value ) ) { if ( in_array ( $ value , [ '0000-00-00 00:00:00' , '0000-00-00' , '' ] ) ) { $ this -> $ propertyName = NULL ; } else { // acquired as current user timezone try { $ this -> $ propertyName = new \ DateTime ( $ value , $ dtz ) ; } catch ( \ Exception $ e ) { $ this -> $ propertyName = NULL ; $ this -> addError ( $ e -> getMessage ( ) ) ; } } // already DateTime object } else if ( is_a ( $ value , 'DateTime' ) ) { // sets the user current tz and assigns $ value -> setTimeZone ( $ dtz ) ; $ this -> $ propertyName = $ value ; // no recognized type/format } else { //$app->logWarning('Unrecognized date variable for ' . $propertyName . ' type ' . gettype($value) . ' having value ' . Utilities::varToText($value)); $ this -> $ propertyName = NULL ; } }
This method will populates a Datetime property with strings or DateTime obj. It
will also sets time zone for all created datetimes with daylight saving value.
Integer timestamps are only managed as UTC.

@param	string	Property’s name.
@param	mixed	Property’s value.
This method will populates a Datetime property with strings or DateTime obj . It will also sets time zone for all created datetimes with daylight saving value . Integer timestamps are only managed as UTC .