How to change timestamp before save?

I have got a timestamp attribute named ‘deadline’. The date is set by a DatePicker, the time should always be 23:59:59.

Picking and saving the date works fine, after picking 13.01.2015 f.e. the content of ‘deadline’ is ‘2015-01-13 00:00:00’.

Now I need help with changing it to ‘2015-01-13 23:59:59’.

After reading the docs I would do that in the BeforeSave function of the model, right?




	public function beforeSave()

	{

		if (parent::beforeSave()) {

			// override time with 23:59:59

			$this->deadline = ... // <-- need help here   

			return true;

		} 

		return false;

	}	



Thanks in advance.

Split deadline using space char.

So:




        public function beforeSave()

        {

                if (parent::beforeSave()) {

                        // override time with 23:59:59

                        $temp = explode(' ',$this->deadline);

                        $this->deadline = $temp[0].' 23:59:59';

                        return true;

                } 

                return false;

        } 



Nice solution. Thank you very much!