bp_core_get_iso8601_date( $timestamp = '' )

Return an ISO-8601 date from a date string.


Description Description


Parameters Parameters

(Required) String of date to convert. Timezone should be UTC before using this.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: bp-core/bp-core-functions.php

	 function bp_core_get_iso8601_date( $timestamp = '' ) {
		if ( ! $timestamp ) {
			return '';
		}

		try {
			$date = new DateTime( $timestamp, new DateTimeZone( 'UTC' ) );

		// Not a valid date, so return blank string.
		} catch( Exception $e ) {
			return '';
		}

		return $date->format( DateTime::ISO8601 );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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