コード例 #1
0
ファイル: wms.py プロジェクト: zhaojiayi/sci-wms
def triple_period_format_z(ds):
    ws = []
    for w in ds:
        ws.append('/'.join(
            [w[0].isoformat(), w[1].isoformat(),
             strftime(w[2], D_DEFAULT)]))
    return ','.join(ws)
コード例 #2
0
ファイル: isotime.py プロジェクト: pkuyken/RDFTranslator
def time_isoformat(ttime, format=TIME_EXT_COMPLETE + TZ_EXT):
    '''
    Format time strings.

    This method is just a wrapper around isodate.isostrf.strftime and uses
    Time-Extended-Complete with extended time zone as default format.
    '''
    return strftime(ttime, format)
コード例 #3
0
def date_isoformat(tdate, format=DATE_EXT_COMPLETE, yeardigits=4):
    """
    Format date strings.

    This method is just a wrapper around isodate.isostrf.strftime and uses
    Date-Extended-Complete as default format.
    """
    return strftime(tdate, format, yeardigits)
コード例 #4
0
def time_isoformat(ttime, format=TIME_EXT_COMPLETE + TZ_EXT):
    '''
    Format time strings.

    This method is just a wrapper around isodate.isostrf.strftime and uses
    Time-Extended-Complete with extended time zone as default format.
    '''
    return strftime(ttime, format)
コード例 #5
0
def date_isoformat(tdate, format=DATE_EXT_COMPLETE, yeardigits=4):
    '''
    Format date strings. 
    
    This method is just a wrapper around isodate.isostrf.strftime and uses
    Date-Extended-Complete as default format.
    '''
    return strftime(tdate, format, yeardigits)
コード例 #6
0
ファイル: isodatetime.py プロジェクト: zsong/isodate
def datetime_isoformat(tdt, format=DATE_EXT_COMPLETE + "T" + TIME_EXT_COMPLETE + TZ_EXT):
    """
    Format datetime strings.

    This method is just a wrapper around isodate.isostrf.strftime and uses
    Extended-Complete as default format.
    """
    return strftime(tdt, format)
コード例 #7
0
ファイル: isodatetime.py プロジェクト: aparup/JoinHour.com-1
def datetime_isoformat(tdt, format=DATE_EXT_COMPLETE + 'T' + 
                                   TIME_EXT_COMPLETE + TZ_EXT):
    '''
    Format datetime strings. 
    
    This method is just a wrapper around isodate.isostrf.strftime and uses
    Extended-Complete as default format.
    '''
    return strftime(tdt, format)
コード例 #8
0
def triple_period_format_z(ds):
    ws = []
    for w in ds:
        ws.append('/'.join([
            w[0].strftime('%Y-%m-%dT%H:%M:%S'),
            w[1].strftime('%Y-%m-%dT%H:%M:%S'),
            strftime(w[2], D_DEFAULT)
        ]))
    return ','.join(ws)
コード例 #9
0
def duration_isoformat(tduration, format=D_DEFAULT):
    '''
    Format duration strings.

    This method is just a wrapper around isodate.isostrf.strftime and uses
    P%P (D_DEFAULT) as default format.
    '''
    #       should be done in Duration class in consistent way with timedelta.
    if ((isinstance(tduration, Duration) and (tduration.years < 0 or
                                             tduration.months < 0 or
                                             tduration.tdelta < timedelta(0)))
        or (isinstance(tduration, timedelta) and (tduration < timedelta(0)))):
        ret = '-'
    else:
        ret = ''
    ret += strftime(tduration, format)
    return ret
コード例 #10
0
def duration_isoformat(tduration, format=D_DEFAULT):
    '''
    Format duration strings.

    This method is just a wrapper around isodate.isostrf.strftime and uses
    P%P (D_DEFAULT) as default format.
    '''
    # TODO: implement better decision for negative Durations.
    #       should be done in Duration class in consistent way with timedelta.
    if ((isinstance(tduration, Duration) and
         (tduration.years < 0 or tduration.months < 0
          or tduration.tdelta < timedelta(0))) or
        (isinstance(tduration, timedelta) and (tduration < timedelta(0)))):
        ret = '-'
    else:
        ret = ''
    ret += strftime(tduration, format)
    return ret
コード例 #11
0
ファイル: wms.py プロジェクト: jdickin/sci-wms
def triple_period_format_z(ds):
    ws = []
    for w in ds:
        ws.append('/'.join([w[0].isoformat(), w[1].isoformat(), strftime(w[2], D_DEFAULT)]))
    return ','.join(ws)