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)
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)
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)
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)
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)
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)
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)
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
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
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)