BP_REST_Learndash_Courses_Endpoint::prepare_date_response( string $date_gmt, string|null $date = null )

Check the post_date_gmt or modified_gmt and prepare any post or modified date for single post output.

Description

Parameters

$date_gmt

(Required) GMT date format.

$date

(Optional) forum date.

Default value: null

Return

(string|null) ISO8601/RFC3339 formatted datetime.

Source

File: bp-integrations/learndash/classes/class-bp-rest-learndash-courses-endpoint.php

	public function prepare_date_response( $date_gmt, $date = null ) {
		// Use the date if passed.
		if ( isset( $date ) ) {
			return mysql_to_rfc3339( $date );
		}

		// Return null if $date_gmt is empty/zeros.
		if ( '0000-00-00 00:00:00' === $date_gmt ) {
			return null;
		}

		// Return the formatted datetime.
		return mysql_to_rfc3339( $date_gmt );
	}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.