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
Return Return
(string)
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 ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: