from datetime import datetime


def stacdate_to_odcdate(datepattern):
    """Function to transform stac date pattern to ODC pattern
    
    Args:
        datepattern (str): A String pattern with date (e. g. CB4_64_16D_STK_v1_020024_2020-07-11_2020-07-26)
    Returns:
        datetime
    """

    start_end = datepattern.split('_')[-2:]
    return (
        datetime.strptime(i, '%Y-%m-%d').strftime("%Y-%m-%d %H:%M:%S.%fZ") for i in start_end
    )