def test_parse_datetime_format1(self): self.assertEqual(utilities.parse_datetime_format1("2012-11-12 01:00:03-08"), datetime(2012, 11, 12, 9, 0, 3, tzinfo=tzutc())) self.assertEqual(utilities.parse_datetime_format1("2012-12-12 23:00:03-05"), datetime(2012, 12, 13, 4, 0, 3, tzinfo=tzutc())) self.assertEqual(utilities.parse_datetime_format1("2012-12-12 23:00:03-00"), datetime(2012, 12, 12, 23, 0, 3, tzinfo=tzutc()))
def test_parse_datetime_format1(self): self.assertEqual( utilities.parse_datetime_format1("2012-11-12 01:00:03-08"), datetime(2012, 11, 12, 9, 0, 3, tzinfo=tzutc())) self.assertEqual( utilities.parse_datetime_format1("2012-12-12 23:00:03-05"), datetime(2012, 12, 13, 4, 0, 3, tzinfo=tzutc())) self.assertEqual( utilities.parse_datetime_format1("2012-12-12 23:00:03-00"), datetime(2012, 12, 12, 23, 0, 3, tzinfo=tzutc()))
def to_utc_date(myString): if not myString or myString=="MISSING": return "MISSING" if myString=="HIDDEN": return "HIDDEN" return utilities.parse_datetime_format1(myString).astimezone(tz.tzutc())
def to_utc_date(myString): if not myString or myString == "MISSING": return "MISSING" if myString == "HIDDEN": return "HIDDEN" return utilities.parse_datetime_format1(myString).astimezone(tz.tzutc())