Viewing 1 replies (of 1 total)
  • Thread Starter Ivan Carlos

    (@ivancarlos)

    Solved this changing the function to include “$datecomfuso” variable to include my timezone in class-refactored-youtube-importer.php file:

    Final code:

    function standardize_video_array( $response ) {
    		$result = array();
    		if ( isset( $response->items ) ) {
    			foreach ( $response->items as $video ) {
    				if ( isset( $video->snippet ) ) $video = $video->snippet;
    				if ( !isset( $video->description ) ) continue;
    				$tags = array();
    				$date = date( 'Y-m-d H:i:s', strtotime( $video->publishedAt ) );
    				$datecomfuso = date('Y-m-d H:i:s', strtotime($date.'+15 hours'));
    				$result[] = array(
    					'title'       => $video->title,
    					'id'          => $video->resourceId->videoId,
    					'url'         => '<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/' . $video->resourceId->videoId . '\" frameborder=\"0\" allowfullscreen></iframe>',
    					'description' => $video->description,
    					'date'        => $datecomfuso,
    					'tags'        => $tags,
    					'raw_data'    => self::object_to_array( $video )
    				);
    			}
    		}
    		return $result;
    	}
Viewing 1 replies (of 1 total)
  • The topic ‘Timezone issue’ is closed to new replies.