Пример #1
0
 static function parseDateTimeString($p_string)
 {
     if (function_exists('iso8601_to_timestamp')) {
         return iso8601_to_timestamp($p_string);
     } else {
         return strtotime($p_string);
     }
 }
Пример #2
0
/**
 * Returns the date in iso8601 format, with proper timezone offset applied
 *
 * @param string $p_date the date in iso8601 format
 * @return int the timestamp
 */
function mci_iso8601_to_timestamp( $p_date ) {

	// retrieve the offset, seems to be lost by nusoap
	$t_utc_date = new DateTime( $p_date, new DateTimeZone( 'UTC' ) );
	$t_timezone = new DateTimeZone( date_default_timezone_get() );
	$t_offset = $t_timezone->getOffset( $t_utc_date );

	$t_raw_timestamp = iso8601_to_timestamp( $p_date );

	return $t_raw_timestamp - $t_offset;

}