(value)
Drop the time and timezone to export date-only values

    >>> to_omrs_date('2017-06-27T12:00:00+0530')
    '2017-06-27'
Drop the time and timezone to export date-only values
Drop the time and timezone to export date - only values
def to_omrs_date(value):
    """
    Drop the time and timezone to export date-only values

    >>> to_omrs_date('2017-06-27T12:00:00+0530')
    '2017-06-27'

    """
    if isinstance(value, str):
        if not re.match(r'\d{4}-\d{2}-\d{2}', value):
            raise ValueError('"{}" is not recognised as a date or a datetime'.format(value))
        value = dateutil_parser.parse(value)
    if isinstance(value, (datetime.date, datetime.datetime)):
        return value.strftime('%Y-%m-%d')
def to_omrs_date ( value ) : if isinstance ( value , str ) : if not re . match ( r'\d{4}-\d{2}-\d{2}' , value ) : raise ValueError ( '"{}" is not recognised as a date or a datetime' . format ( value ) ) value = dateutil_parser . parse ( value ) if isinstance ( value , ( datetime . date , datetime . datetime ) ) : return value . strftime ( '%Y-%m-%d' )