(answer)
return answer
Format CommCare datetime answers for OpenClinica

    >>> from datetime import datetime
    >>> answer = datetime(2015, 8, 19, 19, 8, 15)
    >>> oc_format_date(answer)
    '2015-08-19 19:08:15'
Format CommCare datetime answers for OpenClinica
Format CommCare datetime answers for OpenClinica
def oc_format_date(answer):
    """
    Format CommCare datetime answers for OpenClinica

    >>> from datetime import datetime
    >>> answer = datetime(2015, 8, 19, 19, 8, 15)
    >>> oc_format_date(answer)
    '2015-08-19 19:08:15'

    """
    if isinstance(answer, datetime):
        return answer.isoformat(sep=' ')
    if isinstance(answer, (date, time)):
        return answer.isoformat()
    return answer
def oc_format_date ( answer ) : if isinstance ( answer , datetime ) : return answer . isoformat ( sep = ' ' ) if isinstance ( answer , ( date , time ) ) : return answer . isoformat ( ) return answer