q2 = (
    """CAST(my_col AS INT)
        BETWEEN unix_timestamp('{0}', 'yyyy-MM-dd HH:mm:ss')
        AND unix_timestamp('{1}', 'yyyy-MM-dd HH:mm:ss')"""
    .format(*dates))
sf.where(q2).show()
datetime range filter in PySpark SQL