Hide specific shipping methode depending on day and time of day

To get the current day of week you can use the date('w') function call (complete format description can be found here. The whole condition to exclude the shipping method, say it is saturday and over 11 o’clock, can be written as

date('w') == 6 && date('H') > 11

and the whole if block would be

    if ( array_key_exists( $shipping_rate_id, $rates ) && date('w') == 6 && date('H') > 11 ) {
        unset($rates[$shipping_rate_id]); // remove the shipping method
    }

You are using the 'local_pickup:13' shipping method id as shown in the example you are referring to, but you’d need to find an actual shipping method id for your particular case.