LLMS_Post_Model::get_date( string $key, string $format = null )

Getter for date strings with optional date format conversion If no format is supplied, the default format available via $this->get_date_format() will be used


Description Description


Parameters Parameters

$key

(string) (Required) property key

$format

(string) (Optional) any valid date format that can be passed to date()

Default value: null


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/abstracts/abstract.llms.post.model.php

	public function get_date( $key, $format = null ) {
		$format = ( ! $format ) ? $this->get_date_format() : $format;
		$raw = $this->get( $key );
		// only convert the date if we actually have something stored, otherwise we'll return the current date, which we probably aren't expecting
		$date = $raw ? date_i18n( $format, strtotime( $raw ) ) : '';
		return apply_filters( 'llms_get_' . $this->model_post_type . '_' . $key . '_date', $date, $this );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.





Permalink: