Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_timezone_z(self):
dt = "2008-12-01T18:02:00.522630Z"
l = Literal(dt,
datatype=URIRef('http://www.w3.org/2001/XMLSchema#dateTime'))
self.assertTrue(isinstance(l.toPython(), datetime))
self.assertEqual(datetime_isoformat(l.toPython(),
DATE_EXT_COMPLETE + 'T' + '%H:%M:%S.%f' + TZ_EXT),
dt)
self.assertEqual(l.toPython().isoformat(),
"2008-12-01T18:02:00.522630+00:00")
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 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)
from isodate.isostrf import TIME_EXT_COMPLETE, TIME_EXT_MINUTE
from isodate.isostrf import TIME_HOUR
from isodate.isostrf import TZ_BAS, TZ_EXT, TZ_HOUR
from isodate.isostrf import DT_BAS_COMPLETE, DT_EXT_COMPLETE
from isodate.isostrf import DT_BAS_ORD_COMPLETE, DT_EXT_ORD_COMPLETE
from isodate.isostrf import DT_BAS_WEEK_COMPLETE, DT_EXT_WEEK_COMPLETE
from isodate.isostrf import D_DEFAULT, D_WEEK, D_ALT_EXT, D_ALT_BAS
from isodate.isostrf import D_ALT_BAS_ORD, D_ALT_EXT_ORD
__all__ = (parse_date, date_isoformat, parse_time, time_isoformat,
parse_datetime, datetime_isoformat, parse_duration,
duration_isoformat, ISO8601Error, parse_tzinfo,
tz_isoformat, UTC, FixedOffset, LOCAL, Duration,
strftime, DATE_BAS_COMPLETE, DATE_BAS_ORD_COMPLETE,
DATE_BAS_WEEK, DATE_BAS_WEEK_COMPLETE, DATE_CENTURY,
DATE_EXT_COMPLETE, DATE_EXT_ORD_COMPLETE, DATE_EXT_WEEK,
DATE_EXT_WEEK_COMPLETE, DATE_MONTH, DATE_YEAR,
TIME_BAS_COMPLETE, TIME_BAS_MINUTE, TIME_EXT_COMPLETE,
TIME_EXT_MINUTE, TIME_HOUR, TZ_BAS, TZ_EXT, TZ_HOUR,
DT_BAS_COMPLETE, DT_EXT_COMPLETE, DT_BAS_ORD_COMPLETE,
DT_EXT_ORD_COMPLETE, DT_BAS_WEEK_COMPLETE,
DT_EXT_WEEK_COMPLETE, D_DEFAULT, D_WEEK, D_ALT_EXT,
D_ALT_BAS, D_ALT_BAS_ORD, D_ALT_EXT_ORD)
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)