Set default for ``publish_date``. We can't use ``auto_now_add`` on
        the field as it will be blank when a blog post is created from
        the quick blog form in the admin dashboard.
760648
def save(self, *args, **kwargs):
        
        if self.publish_date is None:
            self.publish_date = now()
        super(Displayable, self).save(*args, **kwargs)
257071
def publishing_set_update_time(sender, instance, **kwargs):
    
    if hasattr(instance, 'publishing_linked'):
        # Hack to avoid updating `publishing_modified_at` field when a draft
        # publishable item is saved as part of a `publish` operation. This
        # ensures that the `publishing_published_at` timestamp is later than
        # the `publishing_modified_at` timestamp when we publish, which is
        # vital for us to correctly detect whether a draft is "dirty".
        if getattr(instance, '_skip_update_publishing_modified_at', False):
            # Reset flag, in case instance is re-used (e.g. in tests)
            instance._skip_update_publishing_modified_at = False
            return
        instance.publishing_modified_at = timezone.now()
1357724
public function setPublishedFrom( $date, $format = null )
    {
        $this->publishedFrom = empty( $date ) ? null : $this->inputDate( $date, $format );
        return $this;
    }
646998
@Column(header = Messages.GUI_HISTORY_DIALOG_COL_DATE_PUBLISHED_0, order = 50)
    public Date getPublishDate() {

        if (m_bean.getPublishDate() == null) {
            return null;
        }
        return new Date(m_bean.getPublishDate().getDate());
    }
189505
public function populateDefaults()
    {
        parent::populateDefaults();

        if (!isset($this->Date) || $this->Date === null) {
            $this->Date = DBDatetime::now()->Format('y-MM-dd 09:00:00');
        }
    }
1097359
private function setFormData()
    {
        $postData = $this->getPostData();
        $currentSetting = $this->getSettings();
        $listSettings = [];

        if ($currentSetting === 'list') {
            $listSettings = $this->getListSettings();
        }

        if ($currentSetting && !isset($postData[self::SOURCE_RADIO_NAME])) {
            $this->sourceElement->setValue($currentSetting);
        }

        if (!empty($listSettings) && !isset($postData[self::SOURCE_LIST_NAME])) {
            $this->sourceDomainsElement->setValue(implode("\n", $listSettings));
        }

        if (isset($postData[self::SOURCE_RADIO_NAME]) && array_key_exists($postData[self::SOURCE_RADIO_NAME], $this->getSourceOptions())) {
            $this->sourceElement->setValue($postData[self::SOURCE_RADIO_NAME]);
        }

        if (isset($postData[self::SOURCE_LIST_NAME])) {
            $this->sourceDomainsElement->setValue($postData[self::SOURCE_LIST_NAME]);
        }
    }
354195
def setCurrentDate( self, date ):
        
        if ( date == self._currentDate or not date.isValid() ):
            return
        
        self._currentDate = date
        self.markForRebuild()
        
        parent = self.parent()
        if ( not parent.signalsBlocked() ):
            parent.currentDateChanged.emit(date)
            parent.titleChanged.emit(self.title())
1331954
def save(self, *args, **kwargs):
        
        # auto fill updated field with current time unless explicitly disabled
        auto_update = kwargs.get('auto_update', True)
        if auto_update:
            self.updated = now()

        # remove eventual auto_update
        if 'auto_update' in kwargs:
            kwargs.pop('auto_update')

        super(BaseDate, self).save(*args, **kwargs)
964179
public function publishRevision()
    {
        if (empty($this->publishedDate)) {
            $this->publishedDate = new \DateTime();
        }

        $this->published = true;
    }
1051551
public function setPreferWrite()
    {
        //====================================================================//
        // Safety Checks ==> Verify a new Field Exists
        if (empty($this->new)) {
            Splash::log()->err("ErrFieldsNoNew");
        } else {
            //====================================================================//
            // Update New Field structure
            $this->new->syncmode = self::MODE_WRITE;
        }

        return $this;
    }
255676
public void setCreatedDate(Date createdDate) {
        _createdDate = createdDate == null ? null : new Date(createdDate.getTime());
    }
272003
public function definition_after_data() {

        $mform = $this->_form;

        // The default end date depends on the course format.
        $format = course_get_format((object)array('format' => get_config('moodlecourse', 'format')));

        // Check if course end date form field should be enabled by default.
        // If a default date is provided to the form element, it is magically enabled by default in the
        // MoodleQuickForm_date_time_selector class, otherwise it's disabled by default.
        if (get_config('moodlecourse', 'courseenddateenabled')) {
            $enddate = $format->get_default_course_enddate($mform, array('startdate' => 'defaults[startdate]'));
            $mform->setDefault('defaults[enddate]', $enddate);
        }
    }
1042638
def set!(date)
      date = Date.parse date if date.is_a?(String)

      message = "DateField##{__callee__} only accepts instances of Date or Time"
      raise ArgumentError, message unless [Date, ::Time].include?(date.class)

      date_string = date.strftime('%Y-%m-%d')
      element_call(:wait_for_writable) { execute_js(:setValue, @element, date_string) }
    end
659448
public function change()
	{
		$table = $this->table('article');
		$table->addColumn('comment_status', 'integer', array(
			'null' => false,
			'default' => 1,
		))
		->save();

		$this->execute('
			UPDATE
				article
			SET comment_status = 0
			WHERE published < date_sub(NOW(), interval 1 month)
		');
	}
1360488
def publish
      @options['date'] ||= read_post_yaml('date') || Time.now.iso8601
      @options['title'] = read_post_yaml('title')

      post_options = {
        'title'     => @options['title'],
        'date'      => @options['date'],
        'slug'      => path_slug(@options['path']),
        'extension' => File.extname(@options['path']).sub(/^\./, ''),
        'content'   => read_post_content,
        'dir'       => @options['dir'],
        'type'      => "post from draft",
        'write_message' => "Published: #{relative_path(path)} →",
        'force'     => @options['force']
      }

      # Create a new post file
      #
      Post.new(site, post_options).write
      
      # Remove the old draft file
      #
      FileUtils.rm @options['path']

    end
474560
def update_publication_datetime
      @post = LatoBlog::Post.find_by(id: params[:id])
      return unless check_post_presence

      @post.post_parent.update(publication_datetime: params[:publication_datetime])
    end
1097746
public function verifyDates()
    {
        if (!$this->startDate()) {
            $this->setStartDate('now');
        }

        if (!$this->endDate()) {
            $this->setEndDate($this->startDate());
        }

        if (!$this->publishDate()) {
            $this->setPublishDate('now');
        }
    }